You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tamaya.apache.org by Romain Manni-Bucau <rm...@gmail.com> on 2015/12/18 09:35:14 UTC

inlining annotation API?

Hi guys,

today to set a value with a default using annotations we do:

@Config("defaultInteger.value") @ConfigDefault("45") private Integer
defaultInteger;

With potentially @Inject.

Wonder why we wouldnt inline it to keep the code more concise and readable?
Most of existing config API are using @Config(key=...,defaultValue=...) or
worse a default in the "value". Shouldnt we just align us there? Also makes
the API simpler having a single entry point.



Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com>

Re: inlining annotation API?

Posted by "Oliver B. Fischer" <o....@swe-blog.net>.
+1

Am 21.12.15 um 00:25 schrieb Alexandru Zbarcea:
> +1
>
> Indeed looks cleaner,
> Alex
> On Dec 20, 2015 4:15 AM, "Romain Manni-Bucau" <rm...@gmail.com> wrote:
>
>> Thks a lot!
>> Le 20 déc. 2015 09:02, "Anatole Tresch" <at...@gmail.com> a écrit :
>>
>> look

-- 
N Oliver B. Fischer
A Schönhauser Allee 64, 10437 Berlin, Deutschland/Germany
P +49 30 44793251
M +49 178 7903538
E o.b.fischer@swe-blog.net
S oliver.b.fischer
J oliver.b.fischer@jabber.org
X http://xing.to/obf


Re: inlining annotation API?

Posted by Alexandru Zbarcea <zb...@gmail.com>.
+1

Indeed looks cleaner,
Alex
On Dec 20, 2015 4:15 AM, "Romain Manni-Bucau" <rm...@gmail.com> wrote:

> Thks a lot!
> Le 20 déc. 2015 09:02, "Anatole Tresch" <at...@gmail.com> a écrit :
>
> > Done.
> >
> > 2015-12-20 8:52 GMT+01:00 Anatole Tresch <at...@gmail.com>:
> >
> > > It's a small thing. I am already writing on this change (currently some
> > > tests in the cdi module fail (all the rest already works), having a
> look
> > at
> > > it).
> > >
> > > 2015-12-18 13:52 GMT+01:00 Romain Manni-Bucau <rm...@gmail.com>:
> > >
> > >> Well I used 5 versions of @Config* (some custom, DS, sabot...) and all
> > >> were
> > >> like that so tend to think it is mainstream to have it inlined.
> > >>
> > >> If someone wants to take this refactoring I'm happy to let him do
> > >> otherwise
> > >> if noone objects before next week I'll try to find time to work on it.
> > >>
> > >> Does it sound good?
> > >>
> > >>
> > >> Romain Manni-Bucau
> > >> @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> > >> <http://rmannibucau.wordpress.com> | Github <
> > >> https://github.com/rmannibucau> |
> > >> LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
> > >> <http://www.tomitribe.com>
> > >>
> > >> 2015-12-18 13:44 GMT+01:00 Werner Keil <we...@gmail.com>:
> > >>
> > >> > Also, a client having extended or partially "forked" DeltaSpike for
> > its
> > >> > needs here also has a @Config... annotation with exactly the notion
> > >> > suggested (key=, defaultValue=) above.
> > >> > Doing so in Tamaya would improve the likelyhood of this or other
> > clients
> > >> > using it at least once it left the Incubator ;-)
> > >> >
> > >> > Werner
> > >> >
> > >> > On Fri, Dec 18, 2015 at 9:59 AM, Werner Keil <werner.keil@gmail.com
> >
> > >> > wrote:
> > >> >
> > >> > > Sounds like a good idea. In other cases, e.g. JMS 2.1 or Java EE
> > >> Security
> > >> > > we also try to find a balance between type-safety via independent
> > >> > > annotations and "annotation hell" by having too many of them ;-)
> > >> > >
> > >> > > Werner
> > >> > >
> > >> > > On Fri, Dec 18, 2015 at 9:35 AM, Romain Manni-Bucau <
> > >> > rmannibucau@gmail.com
> > >> > > > wrote:
> > >> > >
> > >> > >> Hi guys,
> > >> > >>
> > >> > >> today to set a value with a default using annotations we do:
> > >> > >>
> > >> > >> @Config("defaultInteger.value") @ConfigDefault("45") private
> > Integer
> > >> > >> defaultInteger;
> > >> > >>
> > >> > >> With potentially @Inject.
> > >> > >>
> > >> > >> Wonder why we wouldnt inline it to keep the code more concise and
> > >> > >> readable?
> > >> > >> Most of existing config API are using
> > >> @Config(key=...,defaultValue=...)
> > >> > or
> > >> > >> worse a default in the "value". Shouldnt we just align us there?
> > Also
> > >> > >> makes
> > >> > >> the API simpler having a single entry point.
> > >> > >>
> > >> > >>
> > >> > >>
> > >> > >> Romain Manni-Bucau
> > >> > >> @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> > >> > >> <http://rmannibucau.wordpress.com> | Github <
> > >> > >> https://github.com/rmannibucau> |
> > >> > >> LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
> > >> > >> <http://www.tomitribe.com>
> > >> > >>
> > >> > >
> > >> > >
> > >> >
> > >>
> > >
> > >
> > >
> > > --
> > > *Anatole Tresch*
> > > Java Engineer & Architect, JSR Spec Lead
> > > Glärnischweg 10
> > > CH - 8620 Wetzikon
> > >
> > > *Switzerland, Europe Zurich, GMT+1*
> > > *Twitter:  @atsticks*
> > > *Blogs: **http://javaremarkables.blogspot.ch/
> > > <http://javaremarkables.blogspot.ch/>*
> > >
> > > *Google: atsticksMobile  +41-76 344 62 79 <%2B41-76%20344%2062%2079>*
> > >
> > >
> >
> >
> > --
> > *Anatole Tresch*
> > Java Engineer & Architect, JSR Spec Lead
> > Glärnischweg 10
> > CH - 8620 Wetzikon
> >
> > *Switzerland, Europe Zurich, GMT+1*
> > *Twitter:  @atsticks*
> > *Blogs: **http://javaremarkables.blogspot.ch/
> > <http://javaremarkables.blogspot.ch/>*
> >
> > *Google: atsticksMobile  +41-76 344 62 79*
> >
>

Re: inlining annotation API?

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Thks a lot!
Le 20 déc. 2015 09:02, "Anatole Tresch" <at...@gmail.com> a écrit :

> Done.
>
> 2015-12-20 8:52 GMT+01:00 Anatole Tresch <at...@gmail.com>:
>
> > It's a small thing. I am already writing on this change (currently some
> > tests in the cdi module fail (all the rest already works), having a look
> at
> > it).
> >
> > 2015-12-18 13:52 GMT+01:00 Romain Manni-Bucau <rm...@gmail.com>:
> >
> >> Well I used 5 versions of @Config* (some custom, DS, sabot...) and all
> >> were
> >> like that so tend to think it is mainstream to have it inlined.
> >>
> >> If someone wants to take this refactoring I'm happy to let him do
> >> otherwise
> >> if noone objects before next week I'll try to find time to work on it.
> >>
> >> Does it sound good?
> >>
> >>
> >> Romain Manni-Bucau
> >> @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> >> <http://rmannibucau.wordpress.com> | Github <
> >> https://github.com/rmannibucau> |
> >> LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
> >> <http://www.tomitribe.com>
> >>
> >> 2015-12-18 13:44 GMT+01:00 Werner Keil <we...@gmail.com>:
> >>
> >> > Also, a client having extended or partially "forked" DeltaSpike for
> its
> >> > needs here also has a @Config... annotation with exactly the notion
> >> > suggested (key=, defaultValue=) above.
> >> > Doing so in Tamaya would improve the likelyhood of this or other
> clients
> >> > using it at least once it left the Incubator ;-)
> >> >
> >> > Werner
> >> >
> >> > On Fri, Dec 18, 2015 at 9:59 AM, Werner Keil <we...@gmail.com>
> >> > wrote:
> >> >
> >> > > Sounds like a good idea. In other cases, e.g. JMS 2.1 or Java EE
> >> Security
> >> > > we also try to find a balance between type-safety via independent
> >> > > annotations and "annotation hell" by having too many of them ;-)
> >> > >
> >> > > Werner
> >> > >
> >> > > On Fri, Dec 18, 2015 at 9:35 AM, Romain Manni-Bucau <
> >> > rmannibucau@gmail.com
> >> > > > wrote:
> >> > >
> >> > >> Hi guys,
> >> > >>
> >> > >> today to set a value with a default using annotations we do:
> >> > >>
> >> > >> @Config("defaultInteger.value") @ConfigDefault("45") private
> Integer
> >> > >> defaultInteger;
> >> > >>
> >> > >> With potentially @Inject.
> >> > >>
> >> > >> Wonder why we wouldnt inline it to keep the code more concise and
> >> > >> readable?
> >> > >> Most of existing config API are using
> >> @Config(key=...,defaultValue=...)
> >> > or
> >> > >> worse a default in the "value". Shouldnt we just align us there?
> Also
> >> > >> makes
> >> > >> the API simpler having a single entry point.
> >> > >>
> >> > >>
> >> > >>
> >> > >> Romain Manni-Bucau
> >> > >> @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> >> > >> <http://rmannibucau.wordpress.com> | Github <
> >> > >> https://github.com/rmannibucau> |
> >> > >> LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
> >> > >> <http://www.tomitribe.com>
> >> > >>
> >> > >
> >> > >
> >> >
> >>
> >
> >
> >
> > --
> > *Anatole Tresch*
> > Java Engineer & Architect, JSR Spec Lead
> > Glärnischweg 10
> > CH - 8620 Wetzikon
> >
> > *Switzerland, Europe Zurich, GMT+1*
> > *Twitter:  @atsticks*
> > *Blogs: **http://javaremarkables.blogspot.ch/
> > <http://javaremarkables.blogspot.ch/>*
> >
> > *Google: atsticksMobile  +41-76 344 62 79 <%2B41-76%20344%2062%2079>*
> >
> >
>
>
> --
> *Anatole Tresch*
> Java Engineer & Architect, JSR Spec Lead
> Glärnischweg 10
> CH - 8620 Wetzikon
>
> *Switzerland, Europe Zurich, GMT+1*
> *Twitter:  @atsticks*
> *Blogs: **http://javaremarkables.blogspot.ch/
> <http://javaremarkables.blogspot.ch/>*
>
> *Google: atsticksMobile  +41-76 344 62 79*
>

Re: inlining annotation API?

Posted by Anatole Tresch <at...@gmail.com>.
Done.

2015-12-20 8:52 GMT+01:00 Anatole Tresch <at...@gmail.com>:

> It's a small thing. I am already writing on this change (currently some
> tests in the cdi module fail (all the rest already works), having a look at
> it).
>
> 2015-12-18 13:52 GMT+01:00 Romain Manni-Bucau <rm...@gmail.com>:
>
>> Well I used 5 versions of @Config* (some custom, DS, sabot...) and all
>> were
>> like that so tend to think it is mainstream to have it inlined.
>>
>> If someone wants to take this refactoring I'm happy to let him do
>> otherwise
>> if noone objects before next week I'll try to find time to work on it.
>>
>> Does it sound good?
>>
>>
>> Romain Manni-Bucau
>> @rmannibucau <https://twitter.com/rmannibucau> |  Blog
>> <http://rmannibucau.wordpress.com> | Github <
>> https://github.com/rmannibucau> |
>> LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
>> <http://www.tomitribe.com>
>>
>> 2015-12-18 13:44 GMT+01:00 Werner Keil <we...@gmail.com>:
>>
>> > Also, a client having extended or partially "forked" DeltaSpike for its
>> > needs here also has a @Config... annotation with exactly the notion
>> > suggested (key=, defaultValue=) above.
>> > Doing so in Tamaya would improve the likelyhood of this or other clients
>> > using it at least once it left the Incubator ;-)
>> >
>> > Werner
>> >
>> > On Fri, Dec 18, 2015 at 9:59 AM, Werner Keil <we...@gmail.com>
>> > wrote:
>> >
>> > > Sounds like a good idea. In other cases, e.g. JMS 2.1 or Java EE
>> Security
>> > > we also try to find a balance between type-safety via independent
>> > > annotations and "annotation hell" by having too many of them ;-)
>> > >
>> > > Werner
>> > >
>> > > On Fri, Dec 18, 2015 at 9:35 AM, Romain Manni-Bucau <
>> > rmannibucau@gmail.com
>> > > > wrote:
>> > >
>> > >> Hi guys,
>> > >>
>> > >> today to set a value with a default using annotations we do:
>> > >>
>> > >> @Config("defaultInteger.value") @ConfigDefault("45") private Integer
>> > >> defaultInteger;
>> > >>
>> > >> With potentially @Inject.
>> > >>
>> > >> Wonder why we wouldnt inline it to keep the code more concise and
>> > >> readable?
>> > >> Most of existing config API are using
>> @Config(key=...,defaultValue=...)
>> > or
>> > >> worse a default in the "value". Shouldnt we just align us there? Also
>> > >> makes
>> > >> the API simpler having a single entry point.
>> > >>
>> > >>
>> > >>
>> > >> Romain Manni-Bucau
>> > >> @rmannibucau <https://twitter.com/rmannibucau> |  Blog
>> > >> <http://rmannibucau.wordpress.com> | Github <
>> > >> https://github.com/rmannibucau> |
>> > >> LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
>> > >> <http://www.tomitribe.com>
>> > >>
>> > >
>> > >
>> >
>>
>
>
>
> --
> *Anatole Tresch*
> Java Engineer & Architect, JSR Spec Lead
> Glärnischweg 10
> CH - 8620 Wetzikon
>
> *Switzerland, Europe Zurich, GMT+1*
> *Twitter:  @atsticks*
> *Blogs: **http://javaremarkables.blogspot.ch/
> <http://javaremarkables.blogspot.ch/>*
>
> *Google: atsticksMobile  +41-76 344 62 79 <%2B41-76%20344%2062%2079>*
>
>


-- 
*Anatole Tresch*
Java Engineer & Architect, JSR Spec Lead
Glärnischweg 10
CH - 8620 Wetzikon

*Switzerland, Europe Zurich, GMT+1*
*Twitter:  @atsticks*
*Blogs: **http://javaremarkables.blogspot.ch/
<http://javaremarkables.blogspot.ch/>*

*Google: atsticksMobile  +41-76 344 62 79*

Re: inlining annotation API?

Posted by Anatole Tresch <at...@gmail.com>.
It's a small thing. I am already writing on this change (currently some
tests in the cdi module fail (all the rest already works), having a look at
it).

2015-12-18 13:52 GMT+01:00 Romain Manni-Bucau <rm...@gmail.com>:

> Well I used 5 versions of @Config* (some custom, DS, sabot...) and all were
> like that so tend to think it is mainstream to have it inlined.
>
> If someone wants to take this refactoring I'm happy to let him do otherwise
> if noone objects before next week I'll try to find time to work on it.
>
> Does it sound good?
>
>
> Romain Manni-Bucau
> @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> <http://rmannibucau.wordpress.com> | Github <
> https://github.com/rmannibucau> |
> LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
> <http://www.tomitribe.com>
>
> 2015-12-18 13:44 GMT+01:00 Werner Keil <we...@gmail.com>:
>
> > Also, a client having extended or partially "forked" DeltaSpike for its
> > needs here also has a @Config... annotation with exactly the notion
> > suggested (key=, defaultValue=) above.
> > Doing so in Tamaya would improve the likelyhood of this or other clients
> > using it at least once it left the Incubator ;-)
> >
> > Werner
> >
> > On Fri, Dec 18, 2015 at 9:59 AM, Werner Keil <we...@gmail.com>
> > wrote:
> >
> > > Sounds like a good idea. In other cases, e.g. JMS 2.1 or Java EE
> Security
> > > we also try to find a balance between type-safety via independent
> > > annotations and "annotation hell" by having too many of them ;-)
> > >
> > > Werner
> > >
> > > On Fri, Dec 18, 2015 at 9:35 AM, Romain Manni-Bucau <
> > rmannibucau@gmail.com
> > > > wrote:
> > >
> > >> Hi guys,
> > >>
> > >> today to set a value with a default using annotations we do:
> > >>
> > >> @Config("defaultInteger.value") @ConfigDefault("45") private Integer
> > >> defaultInteger;
> > >>
> > >> With potentially @Inject.
> > >>
> > >> Wonder why we wouldnt inline it to keep the code more concise and
> > >> readable?
> > >> Most of existing config API are using
> @Config(key=...,defaultValue=...)
> > or
> > >> worse a default in the "value". Shouldnt we just align us there? Also
> > >> makes
> > >> the API simpler having a single entry point.
> > >>
> > >>
> > >>
> > >> Romain Manni-Bucau
> > >> @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> > >> <http://rmannibucau.wordpress.com> | Github <
> > >> https://github.com/rmannibucau> |
> > >> LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
> > >> <http://www.tomitribe.com>
> > >>
> > >
> > >
> >
>



-- 
*Anatole Tresch*
Java Engineer & Architect, JSR Spec Lead
Glärnischweg 10
CH - 8620 Wetzikon

*Switzerland, Europe Zurich, GMT+1*
*Twitter:  @atsticks*
*Blogs: **http://javaremarkables.blogspot.ch/
<http://javaremarkables.blogspot.ch/>*

*Google: atsticksMobile  +41-76 344 62 79*

Re: inlining annotation API?

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Well I used 5 versions of @Config* (some custom, DS, sabot...) and all were
like that so tend to think it is mainstream to have it inlined.

If someone wants to take this refactoring I'm happy to let him do otherwise
if noone objects before next week I'll try to find time to work on it.

Does it sound good?


Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com>

2015-12-18 13:44 GMT+01:00 Werner Keil <we...@gmail.com>:

> Also, a client having extended or partially "forked" DeltaSpike for its
> needs here also has a @Config... annotation with exactly the notion
> suggested (key=, defaultValue=) above.
> Doing so in Tamaya would improve the likelyhood of this or other clients
> using it at least once it left the Incubator ;-)
>
> Werner
>
> On Fri, Dec 18, 2015 at 9:59 AM, Werner Keil <we...@gmail.com>
> wrote:
>
> > Sounds like a good idea. In other cases, e.g. JMS 2.1 or Java EE Security
> > we also try to find a balance between type-safety via independent
> > annotations and "annotation hell" by having too many of them ;-)
> >
> > Werner
> >
> > On Fri, Dec 18, 2015 at 9:35 AM, Romain Manni-Bucau <
> rmannibucau@gmail.com
> > > wrote:
> >
> >> Hi guys,
> >>
> >> today to set a value with a default using annotations we do:
> >>
> >> @Config("defaultInteger.value") @ConfigDefault("45") private Integer
> >> defaultInteger;
> >>
> >> With potentially @Inject.
> >>
> >> Wonder why we wouldnt inline it to keep the code more concise and
> >> readable?
> >> Most of existing config API are using @Config(key=...,defaultValue=...)
> or
> >> worse a default in the "value". Shouldnt we just align us there? Also
> >> makes
> >> the API simpler having a single entry point.
> >>
> >>
> >>
> >> Romain Manni-Bucau
> >> @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> >> <http://rmannibucau.wordpress.com> | Github <
> >> https://github.com/rmannibucau> |
> >> LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
> >> <http://www.tomitribe.com>
> >>
> >
> >
>

Re: inlining annotation API?

Posted by Werner Keil <we...@gmail.com>.
Also, a client having extended or partially "forked" DeltaSpike for its
needs here also has a @Config... annotation with exactly the notion
suggested (key=, defaultValue=) above.
Doing so in Tamaya would improve the likelyhood of this or other clients
using it at least once it left the Incubator ;-)

Werner

On Fri, Dec 18, 2015 at 9:59 AM, Werner Keil <we...@gmail.com> wrote:

> Sounds like a good idea. In other cases, e.g. JMS 2.1 or Java EE Security
> we also try to find a balance between type-safety via independent
> annotations and "annotation hell" by having too many of them ;-)
>
> Werner
>
> On Fri, Dec 18, 2015 at 9:35 AM, Romain Manni-Bucau <rmannibucau@gmail.com
> > wrote:
>
>> Hi guys,
>>
>> today to set a value with a default using annotations we do:
>>
>> @Config("defaultInteger.value") @ConfigDefault("45") private Integer
>> defaultInteger;
>>
>> With potentially @Inject.
>>
>> Wonder why we wouldnt inline it to keep the code more concise and
>> readable?
>> Most of existing config API are using @Config(key=...,defaultValue=...) or
>> worse a default in the "value". Shouldnt we just align us there? Also
>> makes
>> the API simpler having a single entry point.
>>
>>
>>
>> Romain Manni-Bucau
>> @rmannibucau <https://twitter.com/rmannibucau> |  Blog
>> <http://rmannibucau.wordpress.com> | Github <
>> https://github.com/rmannibucau> |
>> LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
>> <http://www.tomitribe.com>
>>
>
>

Re: inlining annotation API?

Posted by Werner Keil <we...@gmail.com>.
Sounds like a good idea. In other cases, e.g. JMS 2.1 or Java EE Security
we also try to find a balance between type-safety via independent
annotations and "annotation hell" by having too many of them ;-)

Werner

On Fri, Dec 18, 2015 at 9:35 AM, Romain Manni-Bucau <rm...@gmail.com>
wrote:

> Hi guys,
>
> today to set a value with a default using annotations we do:
>
> @Config("defaultInteger.value") @ConfigDefault("45") private Integer
> defaultInteger;
>
> With potentially @Inject.
>
> Wonder why we wouldnt inline it to keep the code more concise and readable?
> Most of existing config API are using @Config(key=...,defaultValue=...) or
> worse a default in the "value". Shouldnt we just align us there? Also makes
> the API simpler having a single entry point.
>
>
>
> Romain Manni-Bucau
> @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> <http://rmannibucau.wordpress.com> | Github <
> https://github.com/rmannibucau> |
> LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
> <http://www.tomitribe.com>
>