Hi Konrad,
Where are (a) and (b) implemented in the ModelAdapterFactory for fields?

Justin

On Thu, Aug 7, 2014 at 1:30 PM, Konrad Windszus <konra...@gmx.de> wrote:
> Currently in Sling Models we do have support for four different kind of type 
> conversions
>
> a) from primitive to wrapper and vice-versa (also within arrays), e.g. 
> Integer to int
> b) from single item to one item collection (both List and Collection), e.g. 
> List<Integer> to Integer
> c) from Adaptable to supported AdapterType
> d) from subtype to super type
>
> That conversion logic must either be implemented in the Injector itself (if 
> it does evaluate the type) or the ModelAdapterFactory is taking care of that. 
> In the latter case the support differs for field and method:
> - Method injection supports only c), d)
> - Field injection supports a), b), c) and d)
>
> The support for these conversions differs a lot between the different 
> injectors.
> 1) BindingsInjector, checks for type itself, does neither support a), b), c) 
> nor d)!
> 2) ChildResource does no type checking, therefore uses the 
> ModelAdapterFactory for the conversions
> 3) OSGiService checks for the type itself, does neither support a), b), c) 
> nor d)!
> 4) RequestAttribute checks for type itself, does neither support a), b), c) 
> nor d)!
> 5) ResourceResolverInjector does no type checking, therefore uses the 
> ModelAdapterFactory for the conversions
> 6) ValueMapInjector, checks for type itself, supports a), b), c)
>
>
> I have several proposals regarding that:
> ======
> - let all injectors support all conversions
> - let both method and field injection support all conversions
> - consolidate the code in one place
> - document the conversions which are supported.
>
> WDYT?
> Konrad

Reply via email to