Class AnnotationMetadataGenUtils

java.lang.Object
io.micronaut.inject.annotation.AnnotationMetadataGenUtils

@Internal public final class AnnotationMetadataGenUtils extends Object
Responsible for writing class files that are instances of AnnotationMetadata.
Since:
1.0
Author:
Graeme Rocher
  • Field Details

    • FIELD_ANNOTATION_METADATA_NAME

      public static final String FIELD_ANNOTATION_METADATA_NAME
      Field name for annotation metadata.
      See Also:
    • TYPE_ANNOTATION_METADATA

      public static final io.micronaut.sourcegen.model.ClassTypeDef TYPE_ANNOTATION_METADATA
    • FIELD_ANNOTATION_METADATA

      public static final io.micronaut.sourcegen.model.FieldDef FIELD_ANNOTATION_METADATA
    • EMPTY_METADATA

      public static final io.micronaut.sourcegen.model.ExpressionDef EMPTY_METADATA
  • Method Details

    • instantiateNewMetadata

      @NonNull public static @NonNull io.micronaut.sourcegen.model.ExpressionDef instantiateNewMetadata(MutableAnnotationMetadata annotationMetadata, Function<String,io.micronaut.sourcegen.model.ExpressionDef> loadClassValueExpressionFn)
      Instantiate new metadata expression.
      Parameters:
      annotationMetadata - The annotation metadata
      loadClassValueExpressionFn - The load type expression fn
      Returns:
      The expression
    • instantiateNewMetadataHierarchy

      @NonNull public static @NonNull io.micronaut.sourcegen.model.ExpressionDef instantiateNewMetadataHierarchy(AnnotationMetadataHierarchy hierarchy, Function<String,io.micronaut.sourcegen.model.ExpressionDef> loadClassValueExpressionFn)
      Instantiate new metadata hierarchy expression.
      Parameters:
      hierarchy - The annotation metadata hierarchy
      loadClassValueExpressionFn - The load type expression fn
      Returns:
      The expression
    • annotationMetadataReference

      @NonNull public static @NonNull io.micronaut.sourcegen.model.ExpressionDef annotationMetadataReference(AnnotationMetadataReference annotationMetadata)
      The annotation metadata reference expression.
      Parameters:
      annotationMetadata - The annotation metadata
      Returns:
      The expression
    • emptyMetadata

      @NonNull public static @NonNull io.micronaut.sourcegen.model.ExpressionDef emptyMetadata()
      The empty annotation metadata expression.
      Returns:
      The expression
    • createLoadClassValueExpressionFn

      @NonNull public static @NonNull Function<String,io.micronaut.sourcegen.model.ExpressionDef> createLoadClassValueExpressionFn(io.micronaut.sourcegen.model.ClassTypeDef declaringType, Map<String,io.micronaut.sourcegen.model.MethodDef> loadTypeMethods)
      Create a new load class value expression function.
      Parameters:
      declaringType - The declaring type
      loadTypeMethods - The load type methods
      Returns:
      The function
    • createGetAnnotationMetadataMethodDef

      @NonNull public static @NonNull io.micronaut.sourcegen.model.MethodDef createGetAnnotationMetadataMethodDef(io.micronaut.sourcegen.model.ClassTypeDef owningType, AnnotationMetadata annotationMetadata)
      Creates a `getAnnotationMetadata` method.
      Parameters:
      owningType - The owning type
      annotationMetadata - The annotation metadata
      Returns:
      The new method
    • createAnnotationMetadataFieldAndInitialize

      @Nullable public static @Nullable io.micronaut.sourcegen.model.FieldDef createAnnotationMetadataFieldAndInitialize(AnnotationMetadata annotationMetadata, Function<String,io.micronaut.sourcegen.model.ExpressionDef> loadClassValueExpressionFn)
      Create annotation metadata field and initialize it to the metadata provided.
      Parameters:
      annotationMetadata - The annotation metadata
      loadClassValueExpressionFn - The function to get the class value
      Returns:
      The new field
    • addAnnotationDefaults

      public static void addAnnotationDefaults(List<io.micronaut.sourcegen.model.StatementDef> statements, AnnotationMetadata annotationMetadata, Function<String,io.micronaut.sourcegen.model.ExpressionDef> loadClassValueExpressionFn)
      Adds the annotation metadata defaults statement/s.
      Parameters:
      statements - The statements
      annotationMetadata - The annotation metadata
      loadClassValueExpressionFn - The load type expression fn