You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by Nicolas Peltier <pe...@gmail.com> on 2020/09/01 08:46:19 UTC

Re: [models] declaring constants for injectors

so should we remove the "Available Injectors" entirely? move it after
"Injector-specific annotation", or more clearly specify you should not use
@source but those annotations?
i'm in favour of the first one. Looks like there is quite a lot of legacy
ways we should move elsewhere or remove

Le lun. 31 août 2020 à 23:10, Stefan Seifert <ss...@pro-vision.de> a
écrit :

> you're right - the "@Inject @Source" pattern is the "old-style" syntax
> which we still have to support for backwards compatibility but probably
> should discourage in the docs and position the injector-specific
> annotations more prominently, as they are the recommended way in my pov.
>
> stefan
>
> >-----Original Message-----
> >From: Nicolas Peltier <pe...@gmail.com>
> >Sent: Monday, August 31, 2020 1:22 PM
> >To: Sling Developers List <de...@sling.apache.org>
> >Subject: Re: [models] declaring constants for injectors
> >
> >i guess doc is a bit misleading here and we should not expose what you
> >righteously call "implementation details" in the documentation (see
> >"script-bindings" in
> >https://sling.apache.org/documentation/bundles/models.html)
> >
> >Le lun. 31 août 2020 à 12:34, Nicolas Peltier <pe...@gmail.com>
> a
> >écrit :
> >
> >> mm i thought some of them were only available through the @Source
> >> annotation, but i will work my models annotations a bit more :-)
> >>
> >> Le lun. 31 août 2020 à 12:10, Stefan Seifert <ss...@pro-vision.de> a
> >> écrit :
> >>
> >>> these string constants are normally not used in application code,
> >because
> >>> they use the typed injector annotations.
> >>> so this is more an implementation detail and there is no need to
> publish
> >>> those constants as part of the API?
> >>>
> >>> stefan
> >>>
> >>> >-----Original Message-----
> >>> >From: Nicolas Peltier <np...@apache.org>
> >>> >Sent: Monday, August 31, 2020 12:07 PM
> >>> >To: Sling Developers List <de...@sling.apache.org>
> >>> >Subject: [models] declaring constants for injectors
> >>> >
> >>> >Hey
> >>> >
> >>> >all injectors have name declared as direct string constants in getName
> >>> >implementations (script-bindings, child-resources, self, ...)
> >>> >not entirely sure it's still best practice to use constants rather
> than
> >>> >literals in annotation, but if it's still the case, i guess declaring
> &
> >>> >exposing those literals in the API would make sense.
> >>> >
> >>> >Wdyt?
> >>> >
> >>> >Nicolas
> >>>
> >>
>

Re: [models] declaring constants for injectors

Posted by Paul Bjorkstrand <pa...@gmail.com>.
If the goal is to dissuade the use of the @Source, it might be worthwhile
to deprecate the annotation, and come up with a new one that is only
allowed on ElementType.ANNOTATION_TYPE. The deprecation, along with the
mentioned documentation changes, would signal that @Source should not be
used, and that an injector-specific annotation should be used (or created,
in the case of custom injectors) instead.

-Paul


On Tue, Sep 1, 2020 at 3:46 AM Nicolas Peltier <pe...@gmail.com>
wrote:

> so should we remove the "Available Injectors" entirely? move it after
> "Injector-specific annotation", or more clearly specify you should not use
> @source but those annotations?
> i'm in favour of the first one. Looks like there is quite a lot of legacy
> ways we should move elsewhere or remove
>
> Le lun. 31 août 2020 à 23:10, Stefan Seifert <ss...@pro-vision.de> a
> écrit :
>
> > you're right - the "@Inject @Source" pattern is the "old-style" syntax
> > which we still have to support for backwards compatibility but probably
> > should discourage in the docs and position the injector-specific
> > annotations more prominently, as they are the recommended way in my pov.
> >
> > stefan
> >
> > >-----Original Message-----
> > >From: Nicolas Peltier <pe...@gmail.com>
> > >Sent: Monday, August 31, 2020 1:22 PM
> > >To: Sling Developers List <de...@sling.apache.org>
> > >Subject: Re: [models] declaring constants for injectors
> > >
> > >i guess doc is a bit misleading here and we should not expose what you
> > >righteously call "implementation details" in the documentation (see
> > >"script-bindings" in
> > >https://sling.apache.org/documentation/bundles/models.html)
> > >
> > >Le lun. 31 août 2020 à 12:34, Nicolas Peltier <
> peltier.nicolas@gmail.com>
> > a
> > >écrit :
> > >
> > >> mm i thought some of them were only available through the @Source
> > >> annotation, but i will work my models annotations a bit more :-)
> > >>
> > >> Le lun. 31 août 2020 à 12:10, Stefan Seifert <ss...@pro-vision.de>
> a
> > >> écrit :
> > >>
> > >>> these string constants are normally not used in application code,
> > >because
> > >>> they use the typed injector annotations.
> > >>> so this is more an implementation detail and there is no need to
> > publish
> > >>> those constants as part of the API?
> > >>>
> > >>> stefan
> > >>>
> > >>> >-----Original Message-----
> > >>> >From: Nicolas Peltier <np...@apache.org>
> > >>> >Sent: Monday, August 31, 2020 12:07 PM
> > >>> >To: Sling Developers List <de...@sling.apache.org>
> > >>> >Subject: [models] declaring constants for injectors
> > >>> >
> > >>> >Hey
> > >>> >
> > >>> >all injectors have name declared as direct string constants in
> getName
> > >>> >implementations (script-bindings, child-resources, self, ...)
> > >>> >not entirely sure it's still best practice to use constants rather
> > than
> > >>> >literals in annotation, but if it's still the case, i guess
> declaring
> > &
> > >>> >exposing those literals in the API would make sense.
> > >>> >
> > >>> >Wdyt?
> > >>> >
> > >>> >Nicolas
> > >>>
> > >>
> >
>