Annotation Type Introspected


  • @Documented
    @Retention(RUNTIME)
    @Target({TYPE,ANNOTATION_TYPE})
    @Inherited
    public @interface Introspected
    An annotation that indicates a type should produce a BeanIntrospection at compilation time.

    Typically to produce a BeanIntrospection one simply annotates a class with this annotation.

     @Introspected
     public class MyBean {
          ...
     }

    An alternative approach is to use a AnnotationMapper to enable introspection for existing annotations such as javax.persistence.Entity.

    If the classes you wish to introspect are already compiled then this annotation can be used on another class (doesn't matter which, but typically on a configuration class) to specify which existing compiled classes to produce BeanIntrospection instances for either through the classes() method or the packages() method. The latter uses compile time package scanning and for the moment is regarded as Experimental.

     @Introspected(classes = MyBean.class)
     public class MyConfiguration {
          ...
     }
    Since:
    1.1
    See Also:
    BeanIntrospection, BeanIntrospector
    • Element Detail

      • classes

        java.lang.Class<?>[] classes
        By default Introspected applies to the class it is applied on. However if classes are specified introspections will instead be generated for each class specified. This is useful in cases where you cannot alter the source code and wish to generate introspections for already compiled classes.
        Returns:
        The classes to generate introspections for
        Default:
        {}
      • visibility

        Introspected.Visibility[] visibility
        Allows specifying the visibility policy to use to control which fields and methods are included.
        Returns:
        The visibility policies
        Since:
        3.2.0
        Default:
        {io.micronaut.core.annotation.Introspected.Visibility.DEFAULT}
      • packages

        java.lang.String[] packages

        By default Introspected applies to the class it is applied on. However if packages are specified introspections will instead be generated for each classes in the given package. Note this only applies to already compiled classes, and classpath scanning will be used to find them. If the class is not compiled then apply the annotation directly to the classs instead.

        Must be specified in combination with includedAnnotations()

        Returns:
        The packages to generate introspections for
        Default:
        {}
      • includes

        java.lang.String[] includes
        The property names to include. Defaults to all properties.
        Returns:
        The names of the properties
        Default:
        {}
      • excludes

        java.lang.String[] excludes
        The property names to excludes. Defaults to excluding none.
        Returns:
        The names of the properties
        Default:
        {}
      • excludedAnnotations

        java.lang.Class<? extends java.lang.annotation.Annotation>[] excludedAnnotations
        The annotation types that if present on the property cause the property to be excluded from results.
        Returns:
        The annotation types
        Default:
        {}
      • includedAnnotations

        java.lang.Class<? extends java.lang.annotation.Annotation>[] includedAnnotations
        The annotation types that if present on the property cause only the properties with the specified annotation to be included in the result.
        Returns:
        The annotation types
        Default:
        {}
      • annotationMetadata

        boolean annotationMetadata
        Whether annotation metadata should be included in the inspection results.
        Returns:
        True if annotation metadata should be included.
        Default:
        true
      • withPrefix

        java.lang.String withPrefix
        Returns:
        The prefix used for copy constructor invoking methods on immutable types. The default is "with".
        Since:
        2.3.0
        Default:
        "with"
      • targetPackage

        java.lang.String targetPackage
        Returns:
        The package to write introspections to. By default, uses the class package.
        Since:
        3.9.0
        Default:
        ""