Class Annotations


  • public final class Annotations
    extends Object
    • Method Detail

      • createAnnotationInstance

        public static <A extends Annotation> A createAnnotationInstance​(Class<A> type)
        Create an instance of the specified annotation type with default attributes.
        Type Parameters:
        A - The generic annotation type.
        Parameters:
        type - The annotation type.
        Returns:
        An annotation instance of the specified annotation type with default attributes.
      • createAnnotationInstances

        @SafeVarargs
        public static <A extends Annotation> A[] createAnnotationInstances​(Class<A>... types)
        Create an array of instances of the specified annotation types with default attributes. Useful for varargs calls such as CDI.current().select(type, createAnnotationInstances(Qualifier1.class, Qualifier2.class)).
        Type Parameters:
        A - The generic annotation type.
        Parameters:
        types - The annotation types.
        Returns:
        An array of instances of the specified annotation types with default attributes.
      • createAnnotationInstance

        public static <A extends Annotation> A createAnnotationInstance​(Class<A> type,
                                                                        Map<String,​Object> attributes)
        Create an instance of the specified annotation type with given attributes.
        Type Parameters:
        A - The generic annotation type.
        Parameters:
        type - The annotation type.
        attributes - The annotation attributes. May be a partial attribute map or even an empty map.
        Returns:
        An annotation instance of the specified annotation type with given attributes.