polygene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Niclas Hedhman <nic...@hedhman.org>
Subject Re: Repeating annotations
Date Mon, 07 Sep 2015 05:56:29 GMT
Yes, any of the "many" annotations are candidates for this.
On Sep 6, 2015 23:54, "Paul Merlin" <paul@nosphere.org> wrote:

> Neat.
>
> @Constraints, @Concerns and @SideEffects annotations seems to crave for
> the same treatment.
>
> Here could be some other candidates:
>
> - Service qualifiers annotations (@Tagged, @HasMetaInfo)
> - Some constraints annotations (@Contains, @InstanceOf, @Matches, @OneOf)
>
> I created ZEST-114 while thinking about constraints annotations. But
> this should be revisited once Constraints are Predicates (ZEST-36).
>
> Regarding the singular/plural notations I'd say that @Mixins can be made
> repeatable as is. And that @Mixin is a new feature, repeatable too.
>
> WDYT?
>
> /Paul
>
>
> Kent Sølvsten a écrit :
> > I just stumbled upon a new java8 feature that might be useful.
> >
> > Repeating annotations.
> >
> > Instead of
> >
> > we could do
> >
> > @Mixins( { AssociationMixin.class, ManyAssociationMixin.class,
> NamedAssociationMixin.class } )
> > public interface EntityComposite
> >
> > we could do
> >
> > @Mixin( AssociationMixin.class)
> > @Mixin( ManyAssociationMixin.class) @Mixin( NamedAssociationMixin.class)
> > public interface EntityComposite
> >
> > where the mixin annotation is defined essentially as
> >
> > @Repeatable( Mixins.class)
> > public @interface Mixin {
> >     Class<?>[] value();
> > }
> >
> >
> > Should be simple to add, and some users may find te notation more
> > pleasing to the eye.
> > It might even make it more natural to add more parameters to the
> > annotations down te road
> > (eg allow the user of the mixin to decide the @AppliesTo filter)
> >
> > WDYT?
> >
> > /Kent
> >
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message