polygene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kent SĂžlvsten <kent.soelvs...@gmail.com>
Subject Repeating annotations
Date Sat, 05 Sep 2015 19:05:36 GMT
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)



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