Disclaimer: I don't have a whole ton of experience with Java Generics, but my colleagues and I just spent a solid hour trying to decipher an interface that was structured like this:
interface HasAttributes<A extends HasAttributes<A, B>, B extends HasAttributesType<B>> extends Identification<B> {
What exactly does it mean when an interface generic takes a type parameter that is itself? What does this do?
There is meaning to this - Java's Enum class is a good example of a simliar situation:
public abstract class Enum<E extends Enum<E>> implements Comparable<E>, Serializable
There are some enlightening answers in this Stack Overflow question about Enum that should shed some light on this particular use of generics for you, as well as answer this more elegantly than I could.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With