my previous samples contain errors, due to rush on replying - sorry :) http://people.apache.org/~simonetripodi/ http://simonetripodi.livejournal.com/ http://twitter.com/simonetripodi http://www.99soft.org/
On Wed, Mar 13, 2013 at 6:13 PM, Simone Tripodi <simonetrip...@apache.org> wrote: > Hi Mikhail! > > +1 for varargs, result would look charming like a sunshine: > > public AbstractLifeCycleModule( Class<? extends > Annotation>...annotationTypes ) > { > this( any(), asList( annotationTypes ) ); > } > > Of course I'd change the overloading constructor as well: > > public AbstractLifeCycleModule( Matcher<? super TypeLiteral<?>> > typeMatcher, Class<? extends Annotation>...annotationTypes ) > { > this( Arrays.asList( annotationTypes ), typeMatcher ); > } > > Clean, compact, clear, direct. We cannot ask more :) > Feel free to fill an issue and provide a fix. > > my 2 cents, > -Simo > > http://people.apache.org/~simonetripodi/ > http://simonetripodi.livejournal.com/ > http://twitter.com/simonetripodi > http://www.99soft.org/ > > > On Wed, Mar 13, 2013 at 1:15 PM, Mikhail Mazursky > <mikhail.mazur...@gmail.com> wrote: >> Hi Simone, Jordan. >> >> IMHO AbstractLifeCycleModule should check that the List that was passed to >> it contains no duplicates and throw exception if it does. In any case >> behaviour in such situation should be described it JavaDocs. >> Also, is this ListBuilder need to be public API at all? And maybe get rid >> of it completely by using Arrays.asList()? >> >> 2013/3/12 Simone Tripodi <simonetrip...@apache.org> >> >>> Hi Jordan, >>> >>> >> * the adapted List of annotation should be IMHO a LinkedHashSet, >>> >> otherwise users could specify the same type twice in the list and >>> >> drive the lifecycle engine to invoke twice the same method in >>> >> different phases - IIUC this is not the desired behaviour, or is it? >>> > It's a List because it needs to be ordered. I hadn't thought about >>> duplicates. >>> >>> the LinkedHashSet[1] will preserve the order like the List does, >>> moreover will keep the unicity of its elements. >>> >>>