Spring Framework
AnnotatedElementUtils provides utility static methods for finding annotations, meta-annotations, and repeatable annotations on AnnotatedElements. This class also has methods which support @AliasFor semantics.
package com.logicbig.example;
import org.springframework.context.annotation.Configuration; import org.springframework.core.annotation.AnnotatedElementUtils; import org.springframework.core.annotation.AnnotationAttributes;
@Configuration public class ExampleAliasFor {
public static void main(String[] args) { AnnotationAttributes aa = AnnotatedElementUtils .getMergedAnnotationAttributes(MyObject1.class, AccessRole.class); System.out.println("Attributes of AccessRole used on MyObject1: " + aa); } }
Original Post
package com.logicbig.example;
import org.springframework.context.annotation.Configuration; import org.springframework.core.annotation.AnnotatedElementUtils; import org.springframework.core.annotation.AnnotationAttributes;
@Configuration public class ExampleAliasForMetaAnnotation {
public static void main(String[] args) { AnnotationAttributes aa = AnnotatedElementUtils .getMergedAnnotationAttributes(MyObject2.class, AdminAccess.class); System.out.println("attributes of AdminAccess used on MyObject2 " + aa);
aa = AnnotatedElementUtils .getMergedAnnotationAttributes(MyObject2.class, AccessRole.class); System.out.println("attributes of AccessRole used on MyObject2 " + aa); } }
Original Post
|
|