Package io.micronaut.ast.groovy.visitor
Class AbstractGroovyElement
- java.lang.Object
-
- io.micronaut.ast.groovy.visitor.AbstractGroovyElement
-
- All Implemented Interfaces:
io.micronaut.core.annotation.AnnotatedElement
,io.micronaut.core.annotation.AnnotationMetadata
,io.micronaut.core.annotation.AnnotationMetadataDelegate
,io.micronaut.core.annotation.AnnotationMetadataProvider
,io.micronaut.core.annotation.AnnotationSource
,io.micronaut.core.naming.Described
,io.micronaut.core.naming.Named
,io.micronaut.inject.ast.Element
- Direct Known Subclasses:
GroovyClassElement
,GroovyEnumConstantElement
,GroovyFieldElement
,GroovyMethodElement
,GroovyPackageElement
,GroovyParameterElement
public abstract class AbstractGroovyElement extends java.lang.Object implements io.micronaut.core.annotation.AnnotationMetadataDelegate, io.micronaut.inject.ast.Element
Abstract Groovy element.- Since:
- 1.1
-
-
Field Summary
Fields Modifier and Type Field Description protected org.codehaus.groovy.control.CompilationUnit
compilationUnit
protected org.codehaus.groovy.control.SourceUnit
sourceUnit
protected GroovyVisitorContext
visitorContext
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractGroovyElement(GroovyVisitorContext visitorContext, org.codehaus.groovy.ast.AnnotatedNode annotatedNode, io.micronaut.core.annotation.AnnotationMetadata annotationMetadata)
Default constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.util.Map<java.lang.String,org.codehaus.groovy.ast.ClassNode>
alignNewGenericsInfo(org.codehaus.groovy.ast.GenericsType[] genericsTypes, org.codehaus.groovy.ast.GenericsType[] redirectTypes, java.util.Map<java.lang.String,org.codehaus.groovy.ast.ClassNode> genericsSpec)
Align the given generic types.<T extends java.lang.annotation.Annotation>
io.micronaut.inject.ast.Elementannotate(io.micronaut.core.annotation.AnnotationValue<T> annotationValue)
<T extends java.lang.annotation.Annotation>
io.micronaut.inject.ast.Elementannotate(java.lang.String annotationType, java.util.function.Consumer<io.micronaut.core.annotation.AnnotationValueBuilder<T>> consumer)
boolean
equals(java.lang.Object o)
io.micronaut.core.annotation.AnnotationMetadata
getAnnotationMetadata()
java.util.Optional<java.lang.String>
getDocumentation()
protected io.micronaut.inject.ast.ClassElement
getGenericElement(org.codehaus.groovy.control.SourceUnit sourceUnit, org.codehaus.groovy.ast.ClassNode type, io.micronaut.inject.ast.ClassElement rawElement, java.util.Map<java.lang.String,org.codehaus.groovy.ast.ClassNode> genericsSpec)
Get a generic element for the given element and data.int
hashCode()
boolean
isPackagePrivate()
io.micronaut.inject.ast.Element
removeAnnotation(java.lang.String annotationType)
<T extends java.lang.annotation.Annotation>
io.micronaut.inject.ast.ElementremoveAnnotationIf(java.util.function.Predicate<io.micronaut.core.annotation.AnnotationValue<T>> predicate)
io.micronaut.inject.ast.Element
removeStereotype(java.lang.String annotationType)
protected io.micronaut.core.annotation.AnnotationMetadata
resolveAnnotationMetadata(org.codehaus.groovy.ast.ClassNode type)
Resolves the annotation metadata for the given type.protected java.util.Set<io.micronaut.inject.ast.ElementModifier>
resolveModifiers(org.codehaus.groovy.ast.ClassNode classNode)
Resolve modifiers for a class node.protected java.util.Set<io.micronaut.inject.ast.ElementModifier>
resolveModifiers(org.codehaus.groovy.ast.FieldNode fieldNode)
Resolve modifiers for a field node.protected java.util.Set<io.micronaut.inject.ast.ElementModifier>
resolveModifiers(org.codehaus.groovy.ast.MethodNode methodNode)
Resolve modifiers for a method node.-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.micronaut.core.annotation.AnnotatedElement
isDeclaredNonNull, isDeclaredNullable, isNonNull, isNullable
-
Methods inherited from interface io.micronaut.core.annotation.AnnotationMetadata
getAnnotationValuesByName, getAnnotationValuesByStereotype, getDeclaredAnnotationValuesByName, getValues, hasDeclaredStereotype, isAnnotationPresent, isDeclaredAnnotationPresent
-
Methods inherited from interface io.micronaut.core.annotation.AnnotationMetadataDelegate
booleanValue, booleanValue, booleanValue, booleanValue, classValue, classValue, classValue, classValue, classValues, classValues, classValues, classValues, doubleValue, doubleValue, doubleValue, enumValue, enumValue, enumValue, enumValue, enumValues, enumValues, enumValues, enumValues, findAnnotation, findAnnotation, findDeclaredAnnotation, findDeclaredAnnotation, findRepeatableAnnotation, findRepeatableAnnotation, getAnnotation, getAnnotation, getAnnotationNameByStereotype, getAnnotationNameByStereotype, getAnnotationNames, getAnnotationNamesByStereotype, getAnnotationNamesByStereotype, getAnnotationType, getAnnotationType, getAnnotationTypeByStereotype, getAnnotationTypeByStereotype, getAnnotationTypesByStereotype, getAnnotationTypesByStereotype, getAnnotationTypesByStereotype, getAnnotationValuesByType, getDeclaredAnnotation, getDeclaredAnnotation, getDeclaredAnnotationNameByStereotype, getDeclaredAnnotationNames, getDeclaredAnnotationNamesByStereotype, getDeclaredAnnotationTypeByStereotype, getDeclaredAnnotationTypeByStereotype, getDeclaredAnnotationValuesByType, getDeclaredMetadata, getDeclaredStereotypeAnnotationNames, getDefaultValue, getDefaultValue, getDefaultValue, getDefaultValue, getDefaultValues, getStereotypeAnnotationNames, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValues, getValues, hasAnnotation, hasAnnotation, hasDeclaredAnnotation, hasDeclaredAnnotation, hasDeclaredStereotype, hasDeclaredStereotype, hasDeclaredStereotype, hasPropertyExpressions, hasSimpleAnnotation, hasSimpleDeclaredAnnotation, hasStereotype, hasStereotype, hasStereotype, hasStereotype, intValue, intValue, intValue, isAnnotationPresent, isDeclaredAnnotationPresent, isEmpty, isFalse, isFalse, isPresent, isPresent, isRepeatableAnnotation, isRepeatableAnnotation, isTrue, isTrue, longValue, longValue, stringValue, stringValue, stringValue, stringValue, stringValues, stringValues, stringValues, stringValues, synthesize, synthesize, synthesizeAll, synthesizeAnnotationsByType, synthesizeDeclared, synthesizeDeclared, synthesizeDeclared, synthesizeDeclaredAnnotationsByType
-
-
-
-
Field Detail
-
sourceUnit
protected final org.codehaus.groovy.control.SourceUnit sourceUnit
-
compilationUnit
protected final org.codehaus.groovy.control.CompilationUnit compilationUnit
-
visitorContext
protected final GroovyVisitorContext visitorContext
-
-
Constructor Detail
-
AbstractGroovyElement
protected AbstractGroovyElement(GroovyVisitorContext visitorContext, org.codehaus.groovy.ast.AnnotatedNode annotatedNode, io.micronaut.core.annotation.AnnotationMetadata annotationMetadata)
Default constructor.- Parameters:
visitorContext
- The groovy visitor contextannotatedNode
- The annotated nodeannotationMetadata
- The annotation metadata
-
-
Method Detail
-
getAnnotationMetadata
public io.micronaut.core.annotation.AnnotationMetadata getAnnotationMetadata()
- Specified by:
getAnnotationMetadata
in interfaceio.micronaut.core.annotation.AnnotationMetadataProvider
-
isPackagePrivate
public boolean isPackagePrivate()
- Specified by:
isPackagePrivate
in interfaceio.micronaut.inject.ast.Element
-
annotate
@CompileStatic public <T extends java.lang.annotation.Annotation> io.micronaut.inject.ast.Element annotate(@NonNull java.lang.String annotationType, @NonNull java.util.function.Consumer<io.micronaut.core.annotation.AnnotationValueBuilder<T>> consumer)
- Specified by:
annotate
in interfaceio.micronaut.inject.ast.Element
-
annotate
public <T extends java.lang.annotation.Annotation> io.micronaut.inject.ast.Element annotate(io.micronaut.core.annotation.AnnotationValue<T> annotationValue)
- Specified by:
annotate
in interfaceio.micronaut.inject.ast.Element
-
removeAnnotation
public io.micronaut.inject.ast.Element removeAnnotation(@NonNull java.lang.String annotationType)
- Specified by:
removeAnnotation
in interfaceio.micronaut.inject.ast.Element
-
removeAnnotationIf
public <T extends java.lang.annotation.Annotation> io.micronaut.inject.ast.Element removeAnnotationIf(@NonNull java.util.function.Predicate<io.micronaut.core.annotation.AnnotationValue<T>> predicate)
- Specified by:
removeAnnotationIf
in interfaceio.micronaut.inject.ast.Element
-
removeStereotype
public io.micronaut.inject.ast.Element removeStereotype(@NonNull java.lang.String annotationType)
- Specified by:
removeStereotype
in interfaceio.micronaut.inject.ast.Element
-
alignNewGenericsInfo
protected java.util.Map<java.lang.String,org.codehaus.groovy.ast.ClassNode> alignNewGenericsInfo(@NonNull org.codehaus.groovy.ast.GenericsType[] genericsTypes, @NonNull org.codehaus.groovy.ast.GenericsType[] redirectTypes, @NonNull java.util.Map<java.lang.String,org.codehaus.groovy.ast.ClassNode> genericsSpec)
Align the given generic types.- Parameters:
genericsTypes
- The generic typesredirectTypes
- The redirect typesgenericsSpec
- The current generics spec- Returns:
- The new generic spec
-
getGenericElement
@NonNull protected io.micronaut.inject.ast.ClassElement getGenericElement(@NonNull org.codehaus.groovy.control.SourceUnit sourceUnit, @NonNull org.codehaus.groovy.ast.ClassNode type, @NonNull io.micronaut.inject.ast.ClassElement rawElement, @NonNull java.util.Map<java.lang.String,org.codehaus.groovy.ast.ClassNode> genericsSpec)
Get a generic element for the given element and data.- Parameters:
sourceUnit
- The source unittype
- The typerawElement
- A raw element to fall back togenericsSpec
- The generics spec- Returns:
- The element, never null.
-
getDocumentation
public java.util.Optional<java.lang.String> getDocumentation()
- Specified by:
getDocumentation
in interfaceio.micronaut.inject.ast.Element
-
resolveAnnotationMetadata
@NonNull protected io.micronaut.core.annotation.AnnotationMetadata resolveAnnotationMetadata(@NonNull org.codehaus.groovy.ast.ClassNode type)
Resolves the annotation metadata for the given type.- Parameters:
type
- The type- Returns:
- The annotation metadata
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
resolveModifiers
protected java.util.Set<io.micronaut.inject.ast.ElementModifier> resolveModifiers(org.codehaus.groovy.ast.MethodNode methodNode)
Resolve modifiers for a method node.- Parameters:
methodNode
- The method node- Returns:
- The modifiers
-
resolveModifiers
protected java.util.Set<io.micronaut.inject.ast.ElementModifier> resolveModifiers(org.codehaus.groovy.ast.FieldNode fieldNode)
Resolve modifiers for a field node.- Parameters:
fieldNode
- The field node- Returns:
- The modifiers
-
resolveModifiers
protected java.util.Set<io.micronaut.inject.ast.ElementModifier> resolveModifiers(org.codehaus.groovy.ast.ClassNode classNode)
Resolve modifiers for a class node.- Parameters:
classNode
- The class node- Returns:
- The modifiers
-
-