No way to bind several model classes using RendererBuilder.bind
roshakorost opened this issue · 1 comments
roshakorost commented
In rendererBuilder there are 2 methods, that have wired signature.
public RendererBuilder<T> bind(Class<T> clazz, Renderer<T> prototype)
public RendererBuilder<T> bind(Class<T> clazz, Class<? extends Renderer> prototypeClass)
This signature doesn't allow to bind model classes that extends to T to some prototype.
For example in case when we have class A
and class B
, where B extends A
, if we create RendererBuilder<A>
we can only bind class A
to some prototype. There is no way to bind class B
, because Class<B>
doesn't extends Class<A>
.
I suggests to change signature of these methods to
public <G extends T> RendererBuilder<T> bind(Class<G> clazz, Renderer<G> prototype)
public <G extends T> RendererBuilder<T> bind(Class<G> clazz, Class<? extends Renderer> prototypeClass)
This would allow to bind deferent subclasses of T to renderers.
pedrovgs commented
Seems a better approach. Can you send a PR with your approach to review it deeply?