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
(@NonNull org.codehaus.groovy.ast.ClassNode classNode, @NonNull ElementAnnotationMetadataFactory annotationMetadataFactory, @NonNull Map<String, ClassElement> resolvedGenerics) Builds a new class element for the given type.newClassElement
(org.codehaus.groovy.ast.ClassNode classNode, ElementAnnotationMetadataFactory annotationMetadataFactory) Builds a new class element for the given type.newConstructorElement
(@NonNull ClassElement owningType, @NonNull org.codehaus.groovy.ast.MethodNode constructor, @NonNull ElementAnnotationMetadataFactory annotationMetadataFactory) Builds a new constructor element for the given type.newEnumConstantElement
(@NonNull ClassElement declaringClass, @NonNull org.codehaus.groovy.ast.FieldNode enumConstant, @NonNull ElementAnnotationMetadataFactory annotationMetadataFactory) Builds a new enum constant element for the given type.newFieldElement
(@NonNull ClassElement owningType, @NonNull org.codehaus.groovy.ast.FieldNode field, @NonNull ElementAnnotationMetadataFactory annotationMetadataFactory) Builds a new field element for the given type.newMethodElement
(@NonNull ClassElement owningType, @NonNull org.codehaus.groovy.ast.MethodNode method, @NonNull ElementAnnotationMetadataFactory elementAnnotationMetadataFactory) Builds a new method element for the given type.newSourceClassElement
(org.codehaus.groovy.ast.ClassNode classNode, @NonNull ElementAnnotationMetadataFactory annotationMetadataFactory) Builds a new source class element for the given type.newSourceMethodElement
(@NonNull ClassElement owningType, @NonNull org.codehaus.groovy.ast.MethodNode method, @NonNull ElementAnnotationMetadataFactory elementAnnotationMetadataFactory) Builds a new source method element for the given method.
-
Constructor Details
-
GroovyElementFactory
-
-
Method Details
-
newClassElement
@NonNull public @NonNull 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(@NonNull @NonNull org.codehaus.groovy.ast.ClassNode classNode, @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<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(@NonNull @NonNull ClassElement owningType, @NonNull @NonNull org.codehaus.groovy.ast.MethodNode method, @NonNull @NonNull 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, @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<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
@NonNull public @NonNull GroovyMethodElement newSourceMethodElement(@NonNull @NonNull ClassElement owningType, @NonNull @NonNull org.codehaus.groovy.ast.MethodNode method, @NonNull @NonNull 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(@NonNull @NonNull ClassElement owningType, @NonNull @NonNull org.codehaus.groovy.ast.MethodNode constructor, @NonNull @NonNull 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
@NonNull public @NonNull EnumConstantElement newEnumConstantElement(@NonNull @NonNull ClassElement declaringClass, @NonNull @NonNull org.codehaus.groovy.ast.FieldNode 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<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(@NonNull @NonNull ClassElement owningType, @NonNull @NonNull org.codehaus.groovy.ast.FieldNode field, @NonNull @NonNull 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
-