[ 
https://issues.apache.org/jira/browse/SLING-4242?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14246889#comment-14246889
 ] 

Stefan Seifert commented on SLING-4242:
---------------------------------------

i find such an extension useful.
the mapping from string to enum should be direct with matching enum name and 
string value.

in my point of view the implementation should not be done with a specific 
injector tied to a specific injection source (ValueMap in this case) - you 
could use this for other sources e.g. request attributes or script variables as 
well. there is already type mapping support e.g. for java primtives, it would 
be a nice addition to support enum values there as well.

> Sling Models: make enums injectable from Resource/ValueMap
> ----------------------------------------------------------
>
>                 Key: SLING-4242
>                 URL: https://issues.apache.org/jira/browse/SLING-4242
>             Project: Sling
>          Issue Type: Improvement
>          Components: Extensions
>    Affects Versions: Sling Models Implementation 1.1.0, Sling Models API 1.1.0
>            Reporter: David Herges
>            Priority: Minor
>              Labels: enum, injection, injectionutils, models
>
> As of Sling Models 1.1.0 it seems to not be possible to inject enum values 
> from Resources and ValueMaps.
> A custom injector could provide that feature. GitHub gist: 
> https://gist.github.com/dherges/5d8f3c6b6821759cfa1c
> Question remains whether it is a good idea to do String-to-Enum-mapping in 
> Sling Models?
> Alternative would be to have ResourceDecorators/ValueMapDecorators that 
> already hold enum values.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to