Support for meta-annotations

4 views
Skip to first unread message

Jim Marino

unread,
Jun 29, 2015, 1:14:30 PM6/29/15
to fab...@googlegroups.com
Hi,

FYI, I have checked in support for meta-annotations. This provides the ability for applications to define their own custom annotations, which in turn define a set of standard annotations that can be reused. 

For example, the following annotation defines @Component, @Composite, @EndpointUri as well as standard JAX-RS annotations (@Consumes, @Produces):


@Component
@Composite
@EndpointUri("root")
@Consumes({MediaType.APPLICATION_JSON})
@Produces({MediaType.APPLICATION_JSON})
@java.lang.annotation.Target({java.lang.annotation.ElementType.TYPE})
@java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.RUNTIME)
public @interface Controller {

}

This annotation can be used on multiple classes to avoid having to repeat annotations, which will hopefully cut down on boilerplate code as well as provide more centralized configuration:

@Controller
public class SomeController {

...



Jim

Tomas Fecko

unread,
Jun 29, 2015, 7:56:54 PM6/29/15
to fab...@googlegroups.com
usefull feature...

Dňa 29.6.2015 o 19:14 Jim Marino napísal(a):
--
You received this message because you are subscribed to the Google Groups "fabric3" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fabric3+u...@googlegroups.com.
To post to this group, send email to fab...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fabric3/CA%2B%3DxZJpC80uNnvXw3fV5nMEUSkwoU0ehnR8zqw_dk3OABo5D-w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Jim Marino

unread,
Jun 30, 2015, 9:51:06 AM6/30/15
to fab...@googlegroups.com
Yes, I hope so. The number of annotations you have to write for all of the different libraries in frameworks is almost out-of-hand. I'm hoping this approach cuts down on the clutter and also allows people to simplify their application code. For example, you can define a meta-annotation for a binding such as ZeroMQ with configuration items and then reuse the annotation in different places.

Jim
 

Reply all
Reply to author
Forward
0 new messages