Package spoon.support.reflect.reference
Class CtArrayTypeReferenceImpl<T>
java.lang.Object
spoon.support.reflect.declaration.CtElementImpl
spoon.support.reflect.reference.CtReferenceImpl
spoon.support.reflect.reference.CtTypeReferenceImpl<T>
spoon.support.reflect.reference.CtArrayTypeReferenceImpl<T>
- All Implemented Interfaces:
Serializable
,Cloneable
,FactoryAccessor
,SourcePositionHolder
,CtElement
,CtShadowable
,CtTypeInformation
,CtActualTypeContainer
,CtArrayTypeReference<T>
,CtReference
,CtTypeReference<T>
,CtQueryable
,CtVisitable
public class CtArrayTypeReferenceImpl<T>
extends CtTypeReferenceImpl<T>
implements CtArrayTypeReference<T>
- See Also:
- Serialized Form
-
Nested Class Summary
-
Field Summary
Fields inherited from class spoon.support.reflect.reference.CtReferenceImpl
simplename
Fields inherited from class spoon.support.reflect.declaration.CtElementImpl
ERROR_MESSAGE_TO_STRING, factory, LOGGER, parent
Fields inherited from interface spoon.reflect.reference.CtTypeReference
NULL_TYPE_NAME, OMITTED_TYPE_ARG_NAME
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Accepts a visitorclone()
Clone the element which calls this method in a new object.Gets the Java runtime class of the referenced type.Gets the type of the array elements at the finest grain.Gets the type of the elements contained in this array.Gets the kind of array declaration.int
Returns the number of dimensions of this array type.Returns the fully qualified name of this type declaration.Gets the simple name of referenced element.This method returns a reference to the erased type.boolean
Returns true if it is not a concrete, resolvable class, it if refers to a type parameter directly or indirectly.boolean
<C extends CtArrayTypeReference<T>>
CsetComponentType(CtTypeReference<?> componentType)
Sets the type of the elements contained in this array.<C extends CtArrayTypeReference<T>>
CsetDeclarationKind(CtArrayTypeReferenceImpl.DeclarationKind declarationKind)
Sets the kind of array declaration.<T extends CtReference>
TsetSimpleName(String simplename)
Sets the name of referenced element.setSimplyQualified(boolean isSimplyQualified)
Methods inherited from class spoon.support.reflect.reference.CtTypeReferenceImpl
addActualTypeArgument, asCtIntersectionTypeReference, box, canAccess, canAccess, findClass, getAccessType, getActualAnnotatedElement, getActualTypeArguments, getAllExecutables, getAllFields, getDeclaration, getDeclaredExecutables, getDeclaredField, getDeclaredFields, getDeclaredOrInheritedField, getDeclaringType, getModifiers, getPackage, getSuperclass, getSuperInterfaces, getTopLevelType, getTypeDeclaration, getTypeParameterDeclaration, isAnnotationType, isAnonymous, isArray, isClass, isEnum, isInterface, isLocalType, isParameterized, isPrimitive, isShadow, isSubtypeOf, removeActualTypeArgument, setActualTypeArguments, setDeclaringType, setPackage, setShadow, unbox
Methods inherited from class spoon.support.reflect.reference.CtReferenceImpl
equals, setComments
Methods inherited from class spoon.support.reflect.declaration.CtElementImpl
addAnnotation, addComment, asIterable, comment, delete, descendantIterator, emptyList, emptySet, filterChildren, getAllMetadata, getAnnotatedChildren, getAnnotation, getAnnotation, getAnnotations, getComments, getDirectChildren, getDocComment, getElements, getFactory, getMetadata, getMetadataKeys, getOriginalSourceFragment, getParent, getParent, getParent, getPath, getPosition, getReferencedTypes, getRoleInParent, getShortRepresentation, getValueByRole, hasAnnotation, hashCode, hasParent, isImplicit, isParentInitialized, map, map, prettyprint, putMetadata, removeAnnotation, removeComment, replace, replace, setAllMetadata, setAnnotations, setDocComment, setFactory, setImplicit, setParent, setPosition, setPositions, setValueByRole, toString, toStringDebug, unmodifiableList, updateAllParentsBelow
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface spoon.reflect.reference.CtActualTypeContainer
addActualTypeArgument, getActualTypeArguments, removeActualTypeArgument, setActualTypeArguments
Methods inherited from interface spoon.reflect.declaration.CtElement
addAnnotation, addComment, asIterable, delete, descendantIterator, getAllMetadata, getAnnotatedChildren, getAnnotation, getAnnotation, getAnnotations, getComments, getDirectChildren, getDocComment, getElements, getMetadata, getMetadataKeys, getOriginalSourceFragment, getParent, getParent, getParent, getPath, getPosition, getReferencedTypes, getRoleInParent, getShortRepresentation, getValueByRole, hasAnnotation, hasParent, isImplicit, isParentInitialized, prettyprint, putMetadata, removeAnnotation, removeComment, replace, replace, setAllMetadata, setAnnotations, setDocComment, setImplicit, setParent, setPosition, setPositions, setValueByRole, toString, toStringDebug, updateAllParentsBelow
Methods inherited from interface spoon.reflect.visitor.chain.CtQueryable
filterChildren, map, map
Methods inherited from interface spoon.reflect.reference.CtReference
setComments
Methods inherited from interface spoon.reflect.declaration.CtShadowable
isShadow, setShadow
Methods inherited from interface spoon.reflect.declaration.CtTypeInformation
getAllExecutables, getAllFields, getDeclaredExecutables, getDeclaredField, getDeclaredFields, getDeclaredOrInheritedField, isAnnotationType, isAnonymous, isArray, isClass, isEnum, isInterface, isLocalType, isParameterized, isPrimitive, isSubtypeOf
Methods inherited from interface spoon.reflect.reference.CtTypeReference
asCtIntersectionTypeReference, box, canAccess, canAccess, getAccessType, getDeclaration, getDeclaringType, getModifiers, getPackage, getSuperclass, getSuperInterfaces, getTopLevelType, getTypeDeclaration, getTypeParameterDeclaration, setDeclaringType, setPackage, unbox
Methods inherited from interface spoon.processing.FactoryAccessor
getFactory, setFactory
-
Constructor Details
-
CtArrayTypeReferenceImpl
public CtArrayTypeReferenceImpl()
-
-
Method Details
-
accept
Description copied from interface:CtVisitable
Accepts a visitor- Specified by:
accept
in interfaceCtVisitable
- Overrides:
accept
in classCtTypeReferenceImpl<T>
-
getComponentType
Description copied from interface:CtArrayTypeReference
Gets the type of the elements contained in this array. e.g., if you have the arrayint[][][]
, this method returns a type reference forint[][]
.- Specified by:
getComponentType
in interfaceCtArrayTypeReference<T>
-
getArrayType
Description copied from interface:CtArrayTypeReference
Gets the type of the array elements at the finest grain. e.g., if you have the arrayint[][][]
, this method returns a type reference to "int".- Specified by:
getArrayType
in interfaceCtArrayTypeReference<T>
-
setComponentType
Description copied from interface:CtArrayTypeReference
Sets the type of the elements contained in this array.- Specified by:
setComponentType
in interfaceCtArrayTypeReference<T>
-
getSimpleName
Description copied from interface:CtReference
Gets the simple name of referenced element.- Specified by:
getSimpleName
in interfaceCtArrayTypeReference<T>
- Specified by:
getSimpleName
in interfaceCtReference
- Specified by:
getSimpleName
in interfaceCtTypeReference<T>
- Overrides:
getSimpleName
in classCtReferenceImpl
-
setSimpleName
Description copied from interface:CtReference
Sets the name of referenced element.- Specified by:
setSimpleName
in interfaceCtArrayTypeReference<T>
- Specified by:
setSimpleName
in interfaceCtReference
- Overrides:
setSimpleName
in classCtReferenceImpl
-
getQualifiedName
Description copied from interface:CtTypeInformation
Returns the fully qualified name of this type declaration.- Specified by:
getQualifiedName
in interfaceCtTypeInformation
- Overrides:
getQualifiedName
in classCtTypeReferenceImpl<T>
-
getActualClass
Description copied from interface:CtTypeReference
Gets the Java runtime class of the referenced type. This is a low-level feature, it should never been used, useCtTypeReference.getTypeDeclaration()
instead in order to only stay in the Spoon world and manipulate CtType instead of java.lang.Class.
Note (these are artifacts of the current implementation and might change at any time):-
it will return the version of the class your
Environment.getInputClassLoader()
loads. This might be a version spoon compiled (manually usingSpoonModelBuilder.compile(spoon.SpoonModelBuilder.InputType...)
or implicitly usingEnvironment.shouldCompile()
) or from your classpath (which might be null) - it will run static initializers (executing arbitrary code from the analyzed project in the process)
- it will fail if the static initializers of the class fail
- the Class object may not reflect the CtType in case you made recent changes to it based on point 1
- Specified by:
getActualClass
in interfaceCtTypeReference<T>
- Overrides:
getActualClass
in classCtTypeReferenceImpl<T>
- Returns:
- the Java class or throws a
SpoonClassNotFoundException
if the class is not found.
-
it will return the version of the class your
-
getDimensionCount
public int getDimensionCount()Description copied from interface:CtArrayTypeReference
Returns the number of dimensions of this array type. This corresponds to the number of array types recursively embedded into the current one (seeCtArrayTypeReference.getComponentType()
).- Specified by:
getDimensionCount
in interfaceCtArrayTypeReference<T>
-
getTypeErasure
Description copied from interface:CtTypeInformation
This method returns a reference to the erased type.For example, this will return
List
forList<String>
, orEnum
for the type parameterE
in the enum declaration.- Specified by:
getTypeErasure
in interfaceCtTypeInformation
- Overrides:
getTypeErasure
in classCtTypeReferenceImpl<T>
- Returns:
- a reference to the erased type
- See Also:
- Type Erasure
-
clone
Description copied from interface:CtElement
Clone the element which calls this method in a new object. Note that that references are kept as is, and thus, so if you clone whole classes or methods, some parts of the cloned element (eg executable references) may still point to the initial element. In this case, consider using methodsRefactoring.copyType(CtType)
andRefactoring.copyMethod(CtMethod)
instead which does additional work beyond cloning.- Specified by:
clone
in interfaceCtArrayTypeReference<T>
- Specified by:
clone
in interfaceCtElement
- Specified by:
clone
in interfaceCtReference
- Specified by:
clone
in interfaceCtTypeReference<T>
- Overrides:
clone
in classCtTypeReferenceImpl<T>
-
isSimplyQualified
public boolean isSimplyQualified()- Specified by:
isSimplyQualified
in interfaceCtTypeReference<T>
- Overrides:
isSimplyQualified
in classCtTypeReferenceImpl<T>
- Returns:
- false then fully qualified name is printed. true then type simple name is printed.
-
setSimplyQualified
- Specified by:
setSimplyQualified
in interfaceCtTypeReference<T>
- Overrides:
setSimplyQualified
in classCtTypeReferenceImpl<T>
- Parameters:
isSimplyQualified
- false then the reference is printed fully qualified name. true then only the type name is printed.
-
setDeclarationKind
public <C extends CtArrayTypeReference<T>> C setDeclarationKind(CtArrayTypeReferenceImpl.DeclarationKind declarationKind)Sets the kind of array declaration.- Type Parameters:
C
- type of this instance- Parameters:
declarationKind
- one ofCtArrayTypeReferenceImpl.DeclarationKind
- Returns:
- this instance
-
getDeclarationKind
Gets the kind of array declaration.- Returns:
CtArrayTypeReferenceImpl.DeclarationKind
of this instance
-
isGenerics
public boolean isGenerics()Description copied from interface:CtTypeInformation
Returns true if it is not a concrete, resolvable class, it if refers to a type parameter directly or indirectly. Direct: "T foo" isGenerics returns true. Indirect: List<T>, or Set<List<T>> isGenerics returns true- Specified by:
isGenerics
in interfaceCtTypeInformation
- Overrides:
isGenerics
in classCtTypeReferenceImpl<T>
-