Package io.micronaut.inject.annotation
Class AnnotationMetadataGenUtils
java.lang.Object
io.micronaut.inject.annotation.AnnotationMetadataGenUtils
Responsible for writing class files that are instances of
AnnotationMetadata
.- Since:
- 1.0
- Author:
- Graeme Rocher
-
Field Summary
Modifier and TypeFieldDescriptionstatic final io.micronaut.sourcegen.model.ExpressionDef
static final io.micronaut.sourcegen.model.FieldDef
static final String
Field name for annotation metadata.static final io.micronaut.sourcegen.model.ClassTypeDef
-
Method Summary
Modifier and TypeMethodDescriptionstatic 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.static @NonNull io.micronaut.sourcegen.model.ExpressionDef
annotationMetadataReference
(AnnotationMetadataReference annotationMetadata) The annotation metadata reference expression.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.static @NonNull io.micronaut.sourcegen.model.MethodDef
createGetAnnotationMetadataMethodDef
(io.micronaut.sourcegen.model.ClassTypeDef owningType, AnnotationMetadata annotationMetadata) Creates a `getAnnotationMetadata` method.createLoadClassValueExpressionFn
(io.micronaut.sourcegen.model.ClassTypeDef declaringType, Map<String, io.micronaut.sourcegen.model.MethodDef> loadTypeMethods) Create a new load class value expression function.static @NonNull io.micronaut.sourcegen.model.ExpressionDef
The empty annotation metadata expression.static @NonNull io.micronaut.sourcegen.model.ExpressionDef
instantiateNewMetadata
(MutableAnnotationMetadata annotationMetadata, Function<String, io.micronaut.sourcegen.model.ExpressionDef> loadClassValueExpressionFn) Instantiate new metadata expression.static @NonNull io.micronaut.sourcegen.model.ExpressionDef
instantiateNewMetadataHierarchy
(AnnotationMetadataHierarchy hierarchy, Function<String, io.micronaut.sourcegen.model.ExpressionDef> loadClassValueExpressionFn) Instantiate new metadata hierarchy expression.
-
Field Details
-
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 metadataloadClassValueExpressionFn
- 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 hierarchyloadClassValueExpressionFn
- 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
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 typeloadTypeMethods
- 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 typeannotationMetadata
- 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 metadataloadClassValueExpressionFn
- 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 statementsannotationMetadata
- The annotation metadataloadClassValueExpressionFn
- The load type expression fn
-