Hi,
there is an immutable class:
Scope<Cmp extends Comparable<Cmp>>
public Scope<Cmp> crop(Scope<Cmp> scope) {
...
return new Scope<Cmp>(starts, ends);
}
it has many similar methods is extended by:
Timerange extends Scope<Date>
and many others (also immutable).
Id like them to return object of its type. For example:
timerange.crop(scope)
should return Timerange object, not Scope.
Do I have to override every method (or use reflection)? Is there another way of doing this?
Thanks in advance, Etam.