@Internal public class GroovyClassElement extends AbstractGroovyElement implements ArrayableClassElement
ClassNode
.Modifier and Type | Field and Description |
---|---|
protected org.codehaus.groovy.ast.ClassNode |
classNode |
compilationUnit, sourceUnit, visitorContext
EMPTY_ELEMENT_ARRAY
CLASS_NAME_SUFFIX, EMPTY_METADATA, VALUE_MEMBER
EMPTY
Constructor and Description |
---|
GroovyClassElement(GroovyVisitorContext visitorContext,
org.codehaus.groovy.ast.ClassNode classNode,
AnnotationMetadata annotationMetadata) |
Modifier and Type | Method and Description |
---|---|
java.util.Map<java.lang.String,java.util.Map<java.lang.String,ClassElement>> |
getAllTypeArguments()
Builds a map of all the type parameters for a class, its super classes and interfaces.
|
int |
getArrayDimensions()
If the type is an array, the number of dimensions.
|
java.util.List<PropertyElement> |
getBeanProperties()
Returns the bean properties (getters and setters) for this class element.
|
java.util.Optional<MethodElement> |
getDefaultConstructor()
Find and return a single default constructor.
|
<T extends Element> |
getEnclosedElements(ElementQuery<T> query)
Return the elements that match the given query.
|
java.util.Map<java.lang.String,java.util.Map<java.lang.String,org.codehaus.groovy.ast.ClassNode>> |
getGenericTypeInfo()
Builds and returns the generic type information.
|
java.lang.String |
getName() |
java.lang.Object |
getNativeType()
Returns the native underlying type.
|
java.lang.String |
getPackageName()
The package name.
|
java.util.Optional<MethodElement> |
getPrimaryConstructor()
Find and return a single primary constructor.
|
java.lang.String |
getSimpleName()
The simple name without the package name.
|
java.util.Optional<ClassElement> |
getSuperType()
Returns the super type of this element or empty if the element has no super type.
|
java.util.Map<java.lang.String,ClassElement> |
getTypeArguments() |
java.util.Map<java.lang.String,ClassElement> |
getTypeArguments(java.lang.String type)
Get the type arguments for the given type name.
|
boolean |
isAbstract() |
boolean |
isArray()
Is the type an array.
|
boolean |
isAssignable(ClassElement type)
Tests whether one type is assignable to another.
|
boolean |
isAssignable(java.lang.String type)
Tests whether one type is assignable to another.
|
boolean |
isFinal() |
boolean |
isInner()
Is this type an inner class.
|
boolean |
isInterface() |
boolean |
isPrimitive()
Whether the type is primitive.
|
boolean |
isPrivate() |
boolean |
isProtected() |
boolean |
isPublic() |
boolean |
isStatic() |
java.lang.String |
toString() |
ClassElement |
withArrayDimensions(int arrayDimensions)
Convert the class element to an element for the same type, but with the given number of array dimensions.
|
alignNewGenericsInfo, annotate, getAnnotationMetadata, getGenericElement, isPackagePrivate, resolveAnnotationMetadata, toClassElement
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
fromArray, toArray
getCanonicalName, getEnclosedElement, getFields, getFields, getFirstTypeArgument, getType, getTypeArguments, isAssignable, isEnum, isIterable, isOptional, isRecord, of, of, of
getGenericType
annotate, annotate, annotate, annotate, getDocumentation, isPackagePrivate
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, getAnnotation, getAnnotation, getAnnotationNameByStereotype, getAnnotationNameByStereotype, getAnnotationNames, getAnnotationNamesByStereotype, getAnnotationNamesByStereotype, getAnnotationType, getAnnotationType, getAnnotationTypeByStereotype, getAnnotationTypeByStereotype, getAnnotationTypesByStereotype, getAnnotationTypesByStereotype, getAnnotationValuesByType, getDeclaredAnnotation, getDeclaredAnnotation, getDeclaredAnnotationNameByStereotype, getDeclaredAnnotationNames, getDeclaredAnnotationNamesByStereotype, getDeclaredAnnotationTypeByStereotype, getDeclaredAnnotationTypeByStereotype, getDeclaredAnnotationValuesByType, getDefaultValue, getDefaultValue, getDefaultValue, getDefaultValue, getDefaultValues, 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, isTrue, isTrue, longValue, longValue, stringValue, stringValue, stringValue, stringValue, stringValues, stringValues, synthesize, synthesizeAll, synthesizeAnnotationsByType, synthesizeDeclared, synthesizeDeclared, synthesizeDeclaredAnnotationsByType
hasDeclaredStereotype
isDeclaredNonNull, isDeclaredNullable, isNonNull, isNullable
getAnnotationMetadata
public GroovyClassElement(GroovyVisitorContext visitorContext, org.codehaus.groovy.ast.ClassNode classNode, AnnotationMetadata annotationMetadata)
visitorContext
- The visitor contextclassNode
- The ClassNode
annotationMetadata
- The annotation metadatapublic <T extends Element> java.util.List<T> getEnclosedElements(@NonNull ElementQuery<T> query)
ClassElement
getEnclosedElements
in interface ClassElement
T
- The element typequery
- The query to use.public boolean isInner()
ClassElement
isInner
in interface ClassElement
public boolean isInterface()
isInterface
in interface ClassElement
public boolean isPrimitive()
TypedElement
isPrimitive
in interface TypedElement
public java.util.Optional<ClassElement> getSuperType()
ClassElement
getSuperType
in interface ClassElement
@NonNull public java.util.Optional<MethodElement> getPrimaryConstructor()
ClassElement
Creator
or Inject
.getPrimaryConstructor
in interface ClassElement
@NonNull public java.util.Optional<MethodElement> getDefaultConstructor()
ClassElement
getDefaultConstructor
in interface ClassElement
public java.util.Map<java.lang.String,java.util.Map<java.lang.String,org.codehaus.groovy.ast.ClassNode>> getGenericTypeInfo()
@NonNull public java.util.Map<java.lang.String,ClassElement> getTypeArguments(@NonNull java.lang.String type)
ClassElement
getTypeArguments
in interface ClassElement
type
- The type to retrieve type arguments for@NonNull public java.util.Map<java.lang.String,java.util.Map<java.lang.String,ClassElement>> getAllTypeArguments()
ClassElement
getAllTypeArguments
in interface ClassElement
@NonNull public java.util.Map<java.lang.String,ClassElement> getTypeArguments()
getTypeArguments
in interface ClassElement
public java.util.List<PropertyElement> getBeanProperties()
ClassElement
getBeanProperties
in interface ClassElement
public boolean isArray()
TypedElement
isArray
in interface TypedElement
public ClassElement withArrayDimensions(int arrayDimensions)
ArrayableClassElement
withArrayDimensions
in interface ArrayableClassElement
arrayDimensions
- The number of array dimensions of the new class elementpublic int getArrayDimensions()
TypedElement
getArrayDimensions
in interface TypedElement
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String getName()
public java.lang.String getSimpleName()
ClassElement
getSimpleName
in interface ClassElement
getSimpleName
in interface Element
public java.lang.String getPackageName()
ClassElement
getPackageName
in interface ClassElement
public boolean isAbstract()
isAbstract
in interface Element
public boolean isStatic()
public boolean isPublic()
public boolean isPrivate()
public boolean isFinal()
public boolean isProtected()
isProtected
in interface Element
public java.lang.Object getNativeType()
Element
getNativeType
in interface Element
public boolean isAssignable(java.lang.String type)
ClassElement
isAssignable
in interface ClassElement
type
- The type to checktrue
if and only if the this type is assignable to the secondpublic boolean isAssignable(ClassElement type)
ClassElement
isAssignable
in interface ClassElement
type
- The type to checktrue
if and only if the this type is assignable to the second