Package io.micronaut.ast.groovy.visitor
Class GroovyElementFactory
java.lang.Object
io.micronaut.ast.groovy.visitor.GroovyElementFactory
- All Implemented Interfaces:
ElementFactory<org.codehaus.groovy.ast.AnnotatedNode,
org.codehaus.groovy.ast.ClassNode, org.codehaus.groovy.ast.MethodNode, org.codehaus.groovy.ast.FieldNode>
@Internal
public class GroovyElementFactory
extends Object
implements ElementFactory<org.codehaus.groovy.ast.AnnotatedNode,org.codehaus.groovy.ast.ClassNode,org.codehaus.groovy.ast.MethodNode,org.codehaus.groovy.ast.FieldNode>
Implementation of
ElementFactory
for Groovy.- Since:
- 2.3.0
- Author:
- graemerocher
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionnewClassElement
(org.codehaus.groovy.ast.ClassNode classNode, ElementAnnotationMetadataFactory annotationMetadataFactory) Builds a new class element for the given type.newClassElement
(org.codehaus.groovy.ast.ClassNode classNode, ElementAnnotationMetadataFactory annotationMetadataFactory, Map<String, ClassElement> resolvedGenerics) Builds a new class element for the given type.newConstructorElement
(ClassElement owningType, org.codehaus.groovy.ast.MethodNode constructor, ElementAnnotationMetadataFactory annotationMetadataFactory) Builds a new constructor element for the given type.newEnumConstantElement
(ClassElement declaringClass, org.codehaus.groovy.ast.FieldNode enumConstant, ElementAnnotationMetadataFactory annotationMetadataFactory) Builds a new enum constant element for the given type.newFieldElement
(ClassElement owningType, org.codehaus.groovy.ast.FieldNode field, ElementAnnotationMetadataFactory annotationMetadataFactory) Builds a new field element for the given type.newMethodElement
(ClassElement owningType, org.codehaus.groovy.ast.MethodNode method, ElementAnnotationMetadataFactory elementAnnotationMetadataFactory) Builds a new method element for the given type.newSourceClassElement
(org.codehaus.groovy.ast.ClassNode classNode, ElementAnnotationMetadataFactory annotationMetadataFactory) Builds a new source class element for the given type.newSourceMethodElement
(ClassElement owningType, org.codehaus.groovy.ast.MethodNode method, ElementAnnotationMetadataFactory elementAnnotationMetadataFactory) Builds a new source method element for the given method.
-
Constructor Details
-
GroovyElementFactory
-
-
Method Details
-
newClassElement
public ClassElement newClassElement(org.codehaus.groovy.ast.ClassNode classNode, ElementAnnotationMetadataFactory annotationMetadataFactory) Description copied from interface:ElementFactory
Builds a new class element for the given type.- Specified by:
newClassElement
in interfaceElementFactory<org.codehaus.groovy.ast.AnnotatedNode,
org.codehaus.groovy.ast.ClassNode, org.codehaus.groovy.ast.MethodNode, org.codehaus.groovy.ast.FieldNode> - Parameters:
classNode
- The typeannotationMetadataFactory
- The element annotation metadata factory- Returns:
- The class element
-
newClassElement
@NonNull public @NonNull ClassElement newClassElement(org.codehaus.groovy.ast.ClassNode classNode, ElementAnnotationMetadataFactory annotationMetadataFactory, Map<String, ClassElement> resolvedGenerics) Description copied from interface:ElementFactory
Builds a new class element for the given type.- Specified by:
newClassElement
in interfaceElementFactory<org.codehaus.groovy.ast.AnnotatedNode,
org.codehaus.groovy.ast.ClassNode, org.codehaus.groovy.ast.MethodNode, org.codehaus.groovy.ast.FieldNode> - Parameters:
classNode
- The typeannotationMetadataFactory
- The element annotation metadata factoryresolvedGenerics
- The resolved generics- Returns:
- The class element
-
newMethodElement
@NonNull public @NonNull GroovyMethodElement newMethodElement(ClassElement owningType, org.codehaus.groovy.ast.MethodNode method, ElementAnnotationMetadataFactory elementAnnotationMetadataFactory) Description copied from interface:ElementFactory
Builds a new method element for the given type.- Specified by:
newMethodElement
in interfaceElementFactory<org.codehaus.groovy.ast.AnnotatedNode,
org.codehaus.groovy.ast.ClassNode, org.codehaus.groovy.ast.MethodNode, org.codehaus.groovy.ast.FieldNode> - Parameters:
owningType
- The owning classmethod
- The methodelementAnnotationMetadataFactory
- The element annotation metadata factory- Returns:
- The method element
-
newSourceClassElement
@NonNull public @NonNull ClassElement newSourceClassElement(org.codehaus.groovy.ast.ClassNode classNode, 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<org.codehaus.groovy.ast.AnnotatedNode,
org.codehaus.groovy.ast.ClassNode, org.codehaus.groovy.ast.MethodNode, org.codehaus.groovy.ast.FieldNode> - Parameters:
classNode
- The typeannotationMetadataFactory
- The element annotation metadata factory- Returns:
- The class element
-
newSourceMethodElement
public GroovyMethodElement newSourceMethodElement(ClassElement owningType, org.codehaus.groovy.ast.MethodNode method, ElementAnnotationMetadataFactory elementAnnotationMetadataFactory) 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<org.codehaus.groovy.ast.AnnotatedNode,
org.codehaus.groovy.ast.ClassNode, org.codehaus.groovy.ast.MethodNode, org.codehaus.groovy.ast.FieldNode> - Parameters:
owningType
- The owning classmethod
- The methodelementAnnotationMetadataFactory
- The element annotation metadata factory- Returns:
- The class element
-
newConstructorElement
@NonNull public @NonNull ConstructorElement newConstructorElement(ClassElement owningType, org.codehaus.groovy.ast.MethodNode constructor, ElementAnnotationMetadataFactory annotationMetadataFactory) Description copied from interface:ElementFactory
Builds a new constructor element for the given type.- Specified by:
newConstructorElement
in interfaceElementFactory<org.codehaus.groovy.ast.AnnotatedNode,
org.codehaus.groovy.ast.ClassNode, org.codehaus.groovy.ast.MethodNode, org.codehaus.groovy.ast.FieldNode> - Parameters:
owningType
- The owning classconstructor
- The constructorannotationMetadataFactory
- The element annotation metadata factory- Returns:
- The constructor element
-
newEnumConstantElement
public EnumConstantElement newEnumConstantElement(ClassElement declaringClass, org.codehaus.groovy.ast.FieldNode enumConstant, ElementAnnotationMetadataFactory annotationMetadataFactory) Description copied from interface:ElementFactory
Builds a new enum constant element for the given type.- Specified by:
newEnumConstantElement
in interfaceElementFactory<org.codehaus.groovy.ast.AnnotatedNode,
org.codehaus.groovy.ast.ClassNode, org.codehaus.groovy.ast.MethodNode, org.codehaus.groovy.ast.FieldNode> - Parameters:
declaringClass
- The owning classenumConstant
- The enum constantannotationMetadataFactory
- The element annotation metadata factory- Returns:
- The enum constant element
-
newFieldElement
@NonNull public @NonNull GroovyFieldElement newFieldElement(ClassElement owningType, org.codehaus.groovy.ast.FieldNode field, ElementAnnotationMetadataFactory annotationMetadataFactory) Description copied from interface:ElementFactory
Builds a new field element for the given type.- Specified by:
newFieldElement
in interfaceElementFactory<org.codehaus.groovy.ast.AnnotatedNode,
org.codehaus.groovy.ast.ClassNode, org.codehaus.groovy.ast.MethodNode, org.codehaus.groovy.ast.FieldNode> - Parameters:
owningType
- The owning classfield
- The fieldannotationMetadataFactory
- The element annotation metadata factory- Returns:
- The field element
-