Class JavaElementFactory
java.lang.Object
io.micronaut.annotation.processing.visitor.JavaElementFactory
- All Implemented Interfaces:
ElementFactory<Element,
TypeElement, ExecutableElement, VariableElement>
@Internal
public class JavaElementFactory
extends Object
implements ElementFactory<Element,TypeElement,ExecutableElement,VariableElement>
An implementation of
ElementFactory
for Java.- Since:
- 2.3.0
- Author:
- graemerocher
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionnewClassElement
(@NonNull TypeElement type, @NonNull ElementAnnotationMetadataFactory annotationMetadataFactory) Builds a new class element for the given type.newClassElement
(@NonNull TypeElement type, @NonNull ElementAnnotationMetadataFactory annotationMetadataFactory, @NonNull Map<String, ClassElement> resolvedGenerics) Builds a new class element for the given type.@NonNull io.micronaut.annotation.processing.visitor.JavaConstructorElement
newConstructorElement
(ClassElement owningType, @NonNull ExecutableElement constructor, @NonNull ElementAnnotationMetadataFactory annotationMetadataFactory) Builds a new constructor element for the given type.@NonNull io.micronaut.annotation.processing.visitor.JavaEnumConstantElement
newEnumConstantElement
(ClassElement owningType, @NonNull VariableElement enumConstant, @NonNull ElementAnnotationMetadataFactory annotationMetadataFactory) Builds a new enum constant element for the given type.@NonNull io.micronaut.annotation.processing.visitor.JavaFieldElement
newFieldElement
(ClassElement owningType, @NonNull VariableElement field, @NonNull ElementAnnotationMetadataFactory annotationMetadataFactory) Builds a new field element for the given type.newMethodElement
(ClassElement owningType, @NonNull ExecutableElement method, @NonNull ElementAnnotationMetadataFactory annotationMetadataFactory) Builds a new method element for the given type.newSourceClassElement
(@NonNull TypeElement type, @NonNull ElementAnnotationMetadataFactory annotationMetadataFactory) Builds a new source class element for the given type.newSourceMethodElement
(ClassElement declaringClass, @NonNull ExecutableElement method, @NonNull ElementAnnotationMetadataFactory annotationMetadataFactory) Builds a new source method element for the given method.
-
Constructor Details
-
JavaElementFactory
-
-
Method Details
-
newClassElement
@NonNull public @NonNull JavaClassElement newClassElement(@NonNull @NonNull TypeElement type, @NonNull @NonNull ElementAnnotationMetadataFactory annotationMetadataFactory) Description copied from interface:ElementFactory
Builds a new class element for the given type.- Specified by:
newClassElement
in interfaceElementFactory<Element,
TypeElement, ExecutableElement, VariableElement> - Parameters:
type
- The typeannotationMetadataFactory
- The element annotation metadata factory- Returns:
- The class element
-
newClassElement
@NonNull public @NonNull ClassElement newClassElement(@NonNull @NonNull TypeElement type, @NonNull @NonNull ElementAnnotationMetadataFactory annotationMetadataFactory, @NonNull @NonNull Map<String, ClassElement> resolvedGenerics) Description copied from interface:ElementFactory
Builds a new class element for the given type.- Specified by:
newClassElement
in interfaceElementFactory<Element,
TypeElement, ExecutableElement, VariableElement> - Parameters:
type
- The typeannotationMetadataFactory
- The element annotation metadata factoryresolvedGenerics
- The resolved generics- Returns:
- The class element
-
newSourceClassElement
@NonNull public @NonNull JavaClassElement newSourceClassElement(@NonNull @NonNull TypeElement type, @NonNull @NonNull ElementAnnotationMetadataFactory annotationMetadataFactory) Description copied from interface:ElementFactory
Builds a new source class element for the given type. This method differs fromElementFactory.newClassElement(Object, ElementAnnotationMetadataFactory)
in that it should only be called from elements that are known to originate from source code.- Specified by:
newSourceClassElement
in interfaceElementFactory<Element,
TypeElement, ExecutableElement, VariableElement> - Parameters:
type
- The typeannotationMetadataFactory
- The element annotation metadata factory- Returns:
- The class element
-
newSourceMethodElement
@NonNull public @NonNull JavaMethodElement newSourceMethodElement(ClassElement declaringClass, @NonNull @NonNull ExecutableElement method, @NonNull @NonNull ElementAnnotationMetadataFactory annotationMetadataFactory) Description copied from interface:ElementFactory
Builds a new source method element for the given method. This method differs fromElementFactory.newMethodElement(ClassElement, Object, ElementAnnotationMetadataFactory)
in that it should only be called from elements that are known to originate from source code.- Specified by:
newSourceMethodElement
in interfaceElementFactory<Element,
TypeElement, ExecutableElement, VariableElement> - Parameters:
declaringClass
- The owning classmethod
- The methodannotationMetadataFactory
- The element annotation metadata factory- Returns:
- The class element
-
newMethodElement
@NonNull public @NonNull JavaMethodElement newMethodElement(ClassElement owningType, @NonNull @NonNull ExecutableElement method, @NonNull @NonNull ElementAnnotationMetadataFactory annotationMetadataFactory) Description copied from interface:ElementFactory
Builds a new method element for the given type.- Specified by:
newMethodElement
in interfaceElementFactory<Element,
TypeElement, ExecutableElement, VariableElement> - Parameters:
owningType
- The owning classmethod
- The methodannotationMetadataFactory
- The element annotation metadata factory- Returns:
- The method element
-
newConstructorElement
@NonNull public @NonNull io.micronaut.annotation.processing.visitor.JavaConstructorElement newConstructorElement(ClassElement owningType, @NonNull @NonNull ExecutableElement constructor, @NonNull @NonNull ElementAnnotationMetadataFactory annotationMetadataFactory) Description copied from interface:ElementFactory
Builds a new constructor element for the given type.- Specified by:
newConstructorElement
in interfaceElementFactory<Element,
TypeElement, ExecutableElement, VariableElement> - Parameters:
owningType
- The owning classconstructor
- The constructorannotationMetadataFactory
- The element annotation metadata factory- Returns:
- The constructor element
-
newEnumConstantElement
@NonNull public @NonNull io.micronaut.annotation.processing.visitor.JavaEnumConstantElement newEnumConstantElement(ClassElement owningType, @NonNull @NonNull VariableElement enumConstant, @NonNull @NonNull ElementAnnotationMetadataFactory annotationMetadataFactory) Description copied from interface:ElementFactory
Builds a new enum constant element for the given type.- Specified by:
newEnumConstantElement
in interfaceElementFactory<Element,
TypeElement, ExecutableElement, VariableElement> - Parameters:
owningType
- The owning classenumConstant
- The enum constantannotationMetadataFactory
- The element annotation metadata factory- Returns:
- The enum constant element
-
newFieldElement
@NonNull public @NonNull io.micronaut.annotation.processing.visitor.JavaFieldElement newFieldElement(ClassElement owningType, @NonNull @NonNull VariableElement field, @NonNull @NonNull ElementAnnotationMetadataFactory annotationMetadataFactory) Description copied from interface:ElementFactory
Builds a new field element for the given type.- Specified by:
newFieldElement
in interfaceElementFactory<Element,
TypeElement, ExecutableElement, VariableElement> - Parameters:
owningType
- The owning classfield
- The fieldannotationMetadataFactory
- The element annotation metadata factory- Returns:
- The field element
-