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
Constructors -
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.JavaConstructorElementnewConstructorElement(@NonNull ClassElement owningType, @NonNull ExecutableElement constructor, @NonNull ElementAnnotationMetadataFactory annotationMetadataFactory) Builds a new constructor element for the given type.@NonNull io.micronaut.annotation.processing.visitor.JavaEnumConstantElementnewEnumConstantElement(@NonNull ClassElement owningType, @NonNull VariableElement enumConstant, @NonNull ElementAnnotationMetadataFactory annotationMetadataFactory) Builds a new enum constant element for the given type.@NonNull io.micronaut.annotation.processing.visitor.JavaFieldElementnewFieldElement(@NonNull ClassElement owningType, @NonNull VariableElement field, @NonNull ElementAnnotationMetadataFactory annotationMetadataFactory) Builds a new field element for the given type.newMethodElement(@NonNull 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(@NonNull 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:ElementFactoryBuilds a new class element for the given type.- Specified by:
newClassElementin 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:ElementFactoryBuilds a new class element for the given type.- Specified by:
newClassElementin 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:ElementFactoryBuilds 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:
newSourceClassElementin interfaceElementFactory<Element,TypeElement, ExecutableElement, VariableElement> - Parameters:
type- The typeannotationMetadataFactory- The element annotation metadata factory- Returns:
- The class element
-
newSourceMethodElement
@NonNull public @NonNull JavaMethodElement newSourceMethodElement(@NonNull @NonNull ClassElement declaringClass, @NonNull @NonNull ExecutableElement method, @NonNull @NonNull ElementAnnotationMetadataFactory annotationMetadataFactory) Description copied from interface:ElementFactoryBuilds 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:
newSourceMethodElementin 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(@NonNull @NonNull ClassElement owningType, @NonNull @NonNull ExecutableElement method, @NonNull @NonNull ElementAnnotationMetadataFactory annotationMetadataFactory) Description copied from interface:ElementFactoryBuilds a new method element for the given type.- Specified by:
newMethodElementin 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(@NonNull @NonNull ClassElement owningType, @NonNull @NonNull ExecutableElement constructor, @NonNull @NonNull ElementAnnotationMetadataFactory annotationMetadataFactory) Description copied from interface:ElementFactoryBuilds a new constructor element for the given type.- Specified by:
newConstructorElementin 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(@NonNull @NonNull ClassElement owningType, @NonNull @NonNull VariableElement enumConstant, @NonNull @NonNull ElementAnnotationMetadataFactory annotationMetadataFactory) Description copied from interface:ElementFactoryBuilds a new enum constant element for the given type.- Specified by:
newEnumConstantElementin 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(@NonNull @NonNull ClassElement owningType, @NonNull @NonNull VariableElement field, @NonNull @NonNull ElementAnnotationMetadataFactory annotationMetadataFactory) Description copied from interface:ElementFactoryBuilds a new field element for the given type.- Specified by:
newFieldElementin interfaceElementFactory<Element,TypeElement, ExecutableElement, VariableElement> - Parameters:
owningType- The owning classfield- The fieldannotationMetadataFactory- The element annotation metadata factory- Returns:
- The field element
-