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
(TypeElement type, ElementAnnotationMetadataFactory annotationMetadataFactory) Builds a new class element for the given type.newClassElement
(TypeElement type, ElementAnnotationMetadataFactory annotationMetadataFactory, Map<String, ClassElement> resolvedGenerics) Builds a new class element for the given type.io.micronaut.annotation.processing.visitor.JavaConstructorElement
newConstructorElement
(ClassElement owningType, ExecutableElement constructor, ElementAnnotationMetadataFactory annotationMetadataFactory) Builds a new constructor element for the given type.io.micronaut.annotation.processing.visitor.JavaEnumConstantElement
newEnumConstantElement
(ClassElement owningType, VariableElement enumConstant, ElementAnnotationMetadataFactory annotationMetadataFactory) Builds a new enum constant element for the given type.io.micronaut.annotation.processing.visitor.JavaFieldElement
newFieldElement
(ClassElement owningType, VariableElement field, ElementAnnotationMetadataFactory annotationMetadataFactory) Builds a new field element for the given type.newMethodElement
(ClassElement owningType, ExecutableElement method, ElementAnnotationMetadataFactory annotationMetadataFactory) Builds a new method element for the given type.newSourceClassElement
(TypeElement type, ElementAnnotationMetadataFactory annotationMetadataFactory) Builds a new source class element for the given type.newSourceMethodElement
(ClassElement declaringClass, ExecutableElement method, ElementAnnotationMetadataFactory annotationMetadataFactory) Builds a new source method element for the given method.
-
Constructor Details
-
JavaElementFactory
-
-
Method Details
-
newClassElement
@NonNull public JavaClassElement newClassElement(@NonNull TypeElement type, @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 ClassElement newClassElement(@NonNull TypeElement type, @NonNull ElementAnnotationMetadataFactory annotationMetadataFactory, @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 JavaClassElement newSourceClassElement(@NonNull TypeElement type, @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 JavaMethodElement newSourceMethodElement(ClassElement declaringClass, @NonNull ExecutableElement method, @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 JavaMethodElement newMethodElement(ClassElement owningType, @NonNull ExecutableElement method, @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 io.micronaut.annotation.processing.visitor.JavaConstructorElement newConstructorElement(ClassElement owningType, @NonNull ExecutableElement constructor, @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 io.micronaut.annotation.processing.visitor.JavaEnumConstantElement newEnumConstantElement(ClassElement owningType, @NonNull VariableElement enumConstant, @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 io.micronaut.annotation.processing.visitor.JavaFieldElement newFieldElement(ClassElement owningType, @NonNull VariableElement field, @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
-