A year or so I read an article that explained how I could create an annotation that basically is a container for other annotations. This way if I always use the same 5 annot
For Jackson, this can be done with @JacksonAnnotationsInside
meta-annotation. See this article for more, but code snippet from there is:
@Retention(RetentionPolicy.RUNTIME) // IMPORTANT
@JacksonAnnotationsInside
@JsonInclude(Include.NON_NULL)
@JsonPropertyOrder({ "id", "name" })
public @interface MyStdAnnotations
and from thereon you can use this type for your own classes like so:
@MyStdAnnotations
public class MyBean {
public String name, id;
}
There are some examples here on how to make various combinations of annotations containing other annotations. Is this what you're looking for?
Example from the source:
@Target(ElementType.METHOD)
public @interface SimpleAnnotation {
public String a();
public int b();
)
@Target(ElementType.METHOD)
public @interface ReallyComplexAnnotation {
public SimpleAnnotation[] value();
)
Used like this:
@ReallyComplexAnnotation(
{ @SimpleAnnotation(a="...", b=3), @SimpleAnnotation(a="...", b=4) }
)