Closed jcchavezs closed 7 years ago
From @felixfbecker
This still means there has to be one method for every reference kind, and if someone adds a new reference class, his class might have these check methods, but the built-in reference classes won't have his new isMyCustomReference() method. What is the benefit of isChildOfReference() over doing instanceof ChildOf?
From @felixfbecker
@jcchavezs what do you think about removing the is* methods all together? It appears to me that everything they do can be accomplished by instanceof, which has the benefit that implementations can provide more reference types that can checked for in the same way as native types
From @jcchavezs
@felixfbecker & @beberlei can we continue the discussion from:
here?
From @felixfbecker
@jcchavezs what is the use-case for composing references?
so ChildOf is a final class which means that if you want to extend the behavior, decoration is one the way
That's not really a use case. We are the ones who decide whether it should be final or not, so if we want to allow extensibility, we could easily make it extendable. The question is what is the use case for composing/decorating (which is obviously more code) that cannot be solved with inheritance here. I would prefer native inheritance + instanceof over forbidding inheritance and adding methods for type checking.
This is PR adds a trait for type checking on SpanReferences.
Ping @beberlei and @felixfbecker.