Class AnnotationFactory


  • public final class AnnotationFactory
    extends Object
    Creates live annotations (actually AnnotationProxies) from AnnotationDescriptors.
    See Also:
    AnnotationProxy
    • Constructor Detail

      • AnnotationFactory

        public AnnotationFactory()
    • Method Detail

      • create

        public static <T extends Annotation> T create​(AnnotationDescriptor descriptor)
        Creates an Annotation proxy for the given annotation descriptor.

        NOTE: the proxy here is generated using the ClassLoader of the Annotation type's Class. E.g., if asked to create an Annotation proxy for javax.persistence.Entity we would use the ClassLoader of the javax.persistence.Entity Class for generating the proxy.

        Parameters:
        descriptor - The annotation descriptor
        Returns:
        The annotation proxy
      • create

        public static <T extends Annotation> T create​(AnnotationDescriptor descriptor,
                                                      ClassLoader classLoader)
        Overloaded form of Annotation proxy creation that accepts an explicit ClassLoader.
        Parameters:
        descriptor - The annotation descriptor
        classLoader - The ClassLoader to be used in defining the proxy
        Returns:
        The annotation proxy