1

Can someone please tell me what this is doing. Its a class that holds an extending generic of itself? what does that even mean?

 public abstract class AbstractStructureBuilder<T extends AbstractStructureBuilder> implements IStructureBuilder
    {

       //abstract and concrete methods in here
    }
stackoverflow
  • 18,348
  • 50
  • 129
  • 196
  • possible duplicate of [Why in java enum is declared as Enum>](http://stackoverflow.com/questions/3061759/why-in-java-enum-is-declared-as-enume-extends-enume) in particular [this answer](http://stackoverflow.com/a/3061776/829571). – assylias Nov 29 '12 at 18:33
  • @assylias I'm asking a question of unknown syntax, I cannot draw correlation to an unknown topic. – stackoverflow Nov 29 '12 at 18:34
  • 1
    Does the link I provided help? – Miltos Kokkonidis Nov 29 '12 at 18:40
  • 1
    I commented on your answer. Thanks again for the supporting information – stackoverflow Nov 29 '12 at 18:42
  • @stackoverflow Not sure what you mean - I'm just pointing out the fact that a very good answer has been given on a very similar question, which you might find useful. – assylias Nov 29 '12 at 18:48
  • @assylias It appeared to me that I asked the question and you indicated it was a duplicate and voted to close the question. If that close vote wasn't yours then I apologize. – stackoverflow Nov 29 '12 at 18:50

3 Answers3

1

The correct answer and some rational is given here: http://www.angelikalanger.com/GenericsFAQ/FAQSections/TypeParameters.html#FAQ106

Miltos Kokkonidis
  • 3,888
  • 20
  • 14
1

It means the AbstractStructureBuilder has a type parameter that extends AbstractStructureBuilder.

Garrett Hall
  • 29,524
  • 10
  • 61
  • 76
0

There's not much there, but I would guess this could be a class for representing nodes in a tree or graph. The class would have generified getters and setters. For instance a method getChildren might return a list of T. Then one can extend AbstractStructureBuilder to, for example, make nodes in a family tree. If you do that, then the getter will return List<FamilyTreeNode>.

Joshua Goldberg
  • 5,059
  • 2
  • 34
  • 39