public class HasLabelRenderer<T extends HasLabel> extends AbstractRenderer<T>{ @Override public String render(HasLabel object) { return object == null ? "" : object.getLabel(); } }
This approach is possible due to the fact that in generics e.g. Bounded Type Parameter the type can be of the upper type it is extended. For instance, in example above the type T in HasLabelRenderer<T extends HasLabel> can be of type HasLabel interface.