You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Konrad Windszus (JIRA)" <ji...@apache.org> on 2014/04/22 11:01:37 UTC

[jira] [Comment Edited] (SLING-3499) Support custom annotations with Sling Models

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

Konrad Windszus edited comment on SLING-3499 at 4/22/14 9:00 AM:
-----------------------------------------------------------------

The pull request listed above adds the following annotations (with the optional attributes listed in brackets)

- OSGiService (optional, filter) 
- ChildResource (optional, name, via)
- ScriptVariable (optional, name)
- Value (optional, name, via)
- RequestAttribute (optional, name)

Those annotations make Sling Models inject the field/method only from the mentioned injector. 
Also there are two interfaces added to the API bundle (ModelAnnotationProcessor and ModelAnnotationProcessorFactory) to make it possible to add more custom annotations in the future.


was (Author: kwin):
The pull request listed above adds the following annotations (with the optional attributes listed in brackets)

- OSGiService (optional, filter) 
- ChildResource (optional, name, via)
- ScriptVariable (optional, name)
- Value (optional, name, via)
- RequestAttribute (optional, name)

Those annotations make Sling Models inject the field/method only from the mentioned injector. 
Also there are two interfaces added to the API bundle (ModelAnnotationProcessor and ModelAnnotationProcessorFactory) for adding more custom annotations in the future.

> Support custom annotations with Sling Models
> --------------------------------------------
>
>                 Key: SLING-3499
>                 URL: https://issues.apache.org/jira/browse/SLING-3499
>             Project: Sling
>          Issue Type: New Feature
>          Components: Extensions
>    Affects Versions: Sling Models API 1.0.0, Sling Models Implementation 1.0.2
>            Reporter: Konrad Windszus
>
> To support custom annotations the API needs to be extended. 
> The reasons for custom annotations are listed in http://www.mail-archive.com/dev%40sling.apache.org/msg27918.html. Also it is much more comfortable for developers, since they can use code completion in the IDE to see which options are available for each injector-specific annotation, apart from that it is less code to write (instead of multiple annotations on one field/method I would only have to write one annotation with some attributes).



--
This message was sent by Atlassian JIRA
(v6.2#6252)