Package io.micronaut.inject.ast
Interface ElementFactory<E,C extends E,M extends E,F extends E>
- Type Parameters:
E- The type that represents the super type of all elements in the ASTC- The type that represents a class in the ASTM- The type that represents a method in the ASTF- The type that represents a field in the AST
- All Known Implementing Classes:
GroovyElementFactory,JavaElementFactory
public interface ElementFactory<E,C extends E,M extends E,F extends E>
A factory for creating elements.
- Since:
- 2.3.0
- Author:
- graemerocher
-
Method Summary
Modifier and TypeMethodDescriptiondefault @NonNull ClassElementnewClassElement(C type, @NonNull ElementAnnotationMetadataFactory annotationMetadataFactory, @NonNull Map<String, ClassElement> typeArguments) Deprecated.no longer usednewClassElement(C type, ElementAnnotationMetadataFactory annotationMetadataFactory) Builds a new class element for the given type.newConstructorElement(@NonNull ClassElement owningClass, M constructor, @NonNull ElementAnnotationMetadataFactory elementAnnotationMetadataFactory) Builds a new constructor element for the given type.newEnumConstantElement(@NonNull ClassElement owningClass, F enumConstant, @NonNull ElementAnnotationMetadataFactory elementAnnotationMetadataFactory) Builds a new enum constant element for the given type.newFieldElement(@NonNull ClassElement owningClass, F field, @NonNull ElementAnnotationMetadataFactory elementAnnotationMetadataFactory) Builds a new field element for the given type.newMethodElement(@NonNull ClassElement owningClass, M method, @NonNull ElementAnnotationMetadataFactory elementAnnotationMetadataFactory) Builds a new method element for the given type.newSourceClassElement(C type, @NonNull ElementAnnotationMetadataFactory elementAnnotationMetadataFactory) Builds a new source class element for the given type.newSourceMethodElement(@NonNull ClassElement owningClass, M method, @NonNull ElementAnnotationMetadataFactory elementAnnotationMetadataFactory) Builds a new source method element for the given method.
-
Method Details
-
newClassElement
@NonNull @NonNull ClassElement newClassElement(@NonNull C type, ElementAnnotationMetadataFactory annotationMetadataFactory) Builds a new class element for the given type.- Parameters:
type- The typeannotationMetadataFactory- The element annotation metadata factory- Returns:
- The class element
- Since:
- 4.0.0
-
newClassElement
@NonNull @Deprecated default @NonNull ClassElement newClassElement(@NonNull C type, @NonNull @NonNull ElementAnnotationMetadataFactory annotationMetadataFactory, @NonNull @NonNull Map<String, ClassElement> typeArguments) Deprecated.no longer usedBuilds a new class element for the given type.- Parameters:
type- The typeannotationMetadataFactory- The element annotation metadata factorytypeArguments- The resolved generics- Returns:
- The class element
- Since:
- 4.0.0
-
newSourceClassElement
@NonNull @NonNull ClassElement newSourceClassElement(@NonNull C type, @NonNull @NonNull ElementAnnotationMetadataFactory elementAnnotationMetadataFactory) Builds a new source class element for the given type. This method differs fromnewClassElement(Object, ElementAnnotationMetadataFactory)in that it should only be called from elements that are known to originate from source code.- Parameters:
type- The typeelementAnnotationMetadataFactory- The element annotation metadata factory- Returns:
- The class element
- Since:
- 4.0.0
-
newSourceMethodElement
@NonNull @NonNull MethodElement newSourceMethodElement(@NonNull @NonNull ClassElement owningClass, @NonNull M method, @NonNull @NonNull ElementAnnotationMetadataFactory elementAnnotationMetadataFactory) Builds a new source method element for the given method. This method differs fromnewMethodElement(ClassElement, Object, ElementAnnotationMetadataFactory)in that it should only be called from elements that are known to originate from source code.- Parameters:
owningClass- The owning classmethod- The methodelementAnnotationMetadataFactory- The element annotation metadata factory- Returns:
- The class element
- Since:
- 4.0.0
-
newMethodElement
@NonNull @NonNull MethodElement newMethodElement(@NonNull @NonNull ClassElement owningClass, @NonNull M method, @NonNull @NonNull ElementAnnotationMetadataFactory elementAnnotationMetadataFactory) Builds a new method element for the given type.- Parameters:
owningClass- The owning classmethod- The methodelementAnnotationMetadataFactory- The element annotation metadata factory- Returns:
- The method element
- Since:
- 4.0.0
-
newConstructorElement
@NonNull @NonNull ConstructorElement newConstructorElement(@NonNull @NonNull ClassElement owningClass, @NonNull M constructor, @NonNull @NonNull ElementAnnotationMetadataFactory elementAnnotationMetadataFactory) Builds a new constructor element for the given type.- Parameters:
owningClass- The owning classconstructor- The constructorelementAnnotationMetadataFactory- The element annotation metadata factory- Returns:
- The constructor element
- Since:
- 4.0.0
-
newEnumConstantElement
@NonNull @NonNull EnumConstantElement newEnumConstantElement(@NonNull @NonNull ClassElement owningClass, @NonNull F enumConstant, @NonNull @NonNull ElementAnnotationMetadataFactory elementAnnotationMetadataFactory) Builds a new enum constant element for the given type.- Parameters:
owningClass- The owning classenumConstant- The enum constantelementAnnotationMetadataFactory- The element annotation metadata factory- Returns:
- The enum constant element
- Since:
- 4.0.0
-
newFieldElement
@NonNull @NonNull FieldElement newFieldElement(@NonNull @NonNull ClassElement owningClass, @NonNull F field, @NonNull @NonNull ElementAnnotationMetadataFactory elementAnnotationMetadataFactory) Builds a new field element for the given type.- Parameters:
owningClass- The owning classfield- The fieldelementAnnotationMetadataFactory- The element annotation metadata factory- Returns:
- The field element
- Since:
- 4.0.0
-