Java annotation does not extend or implement, it is irritated me so much
because I see there are much more and more annotation at java programming.
So the idea has come to my thoughts.
We can not extend annotation by annotation, but we can do pretend that
there is composited annotation, offcourse with Lucy.
It is where @Composite is used for:
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
@Composite
@Component
@Singleton
public @interface SingletonComponent {
}
With the example above, @SingletonComponent has two meanings.
1.This is pretend to be @Component
2.This is pretend to be @Singleton
How to pretend?
This is @Composite.
@Composite gives you abbreviate multiple annotation meanings at just one annotaion.
How Lucy do this is when creating annotation meta class, AnnotationDesc,
the annotation which is put @Composite treats as composited annotation that means
there are multiple annotations to make meta class.If so, Lucy analyzes all annotations from
child to parent, and makes multiple annotation meta class.
I mention that Lucy simply does not make annotation meta class for java.lang type annotation and @Composite itself.
So, what gives you if using @Composite are:
-your code are much simpler to see. keep your code clean, baby:)
-it gives you to create so easily one simple annotation from multiple annotaions(isn't that good?)
-you can do customize of framework annotation meanings.