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:
-
Nested Class Summary
Nested Classes -
Field Summary
Fields inherited from class spoon.support.reflect.reference.CtReferenceImpl
simplenameFields inherited from class spoon.support.reflect.declaration.CtElementImpl
ERROR_MESSAGE_TO_STRING, factory, LOGGER, parentFields inherited from interface spoon.reflect.reference.CtTypeReference
NULL_TYPE_NAME, OMITTED_TYPE_ARG_NAME -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAccepts 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.intReturns 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.booleanReturns 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, unboxMethods inherited from class spoon.support.reflect.reference.CtReferenceImpl
equals, setCommentsMethods 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, updateAllParentsBelowMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface spoon.reflect.reference.CtActualTypeContainer
addActualTypeArgument, getActualTypeArguments, removeActualTypeArgument, setActualTypeArgumentsMethods 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, updateAllParentsBelowMethods inherited from interface spoon.reflect.visitor.chain.CtQueryable
filterChildren, map, mapMethods inherited from interface spoon.reflect.reference.CtReference
setCommentsMethods inherited from interface spoon.reflect.declaration.CtShadowable
isShadow, setShadowMethods inherited from interface spoon.reflect.declaration.CtTypeInformation
getAllExecutables, getAllFields, getDeclaredExecutables, getDeclaredField, getDeclaredFields, getDeclaredOrInheritedField, isAnnotationType, isAnonymous, isArray, isClass, isEnum, isInterface, isLocalType, isParameterized, isPrimitive, isSubtypeOfMethods inherited from interface spoon.reflect.reference.CtTypeReference
asCtIntersectionTypeReference, box, canAccess, canAccess, getAccessType, getDeclaration, getDeclaringType, getModifiers, getPackage, getSuperclass, getSuperInterfaces, getTopLevelType, getTypeDeclaration, getTypeParameterDeclaration, setDeclaringType, setPackage, unboxMethods inherited from interface spoon.processing.FactoryAccessor
getFactory, setFactory
-
Constructor Details
-
CtArrayTypeReferenceImpl
public CtArrayTypeReferenceImpl()
-
-
Method Details
-
accept
Description copied from interface:CtVisitableAccepts a visitor- Specified by:
acceptin interfaceCtVisitable- Overrides:
acceptin classCtTypeReferenceImpl<T>
-
getComponentType
Description copied from interface:CtArrayTypeReferenceGets 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:
getComponentTypein interfaceCtArrayTypeReference<T>
-
getArrayType
Description copied from interface:CtArrayTypeReferenceGets 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:
getArrayTypein interfaceCtArrayTypeReference<T>
-
setComponentType
Description copied from interface:CtArrayTypeReferenceSets the type of the elements contained in this array.- Specified by:
setComponentTypein interfaceCtArrayTypeReference<T>
-
getSimpleName
Description copied from interface:CtReferenceGets the simple name of referenced element.- Specified by:
getSimpleNamein interfaceCtArrayTypeReference<T>- Specified by:
getSimpleNamein interfaceCtReference- Specified by:
getSimpleNamein interfaceCtTypeReference<T>- Overrides:
getSimpleNamein classCtReferenceImpl
-
setSimpleName
Description copied from interface:CtReferenceSets the name of referenced element.- Specified by:
setSimpleNamein interfaceCtArrayTypeReference<T>- Specified by:
setSimpleNamein interfaceCtReference- Overrides:
setSimpleNamein classCtReferenceImpl
-
getQualifiedName
Description copied from interface:CtTypeInformationReturns the fully qualified name of this type declaration.- Specified by:
getQualifiedNamein interfaceCtTypeInformation- Overrides:
getQualifiedNamein classCtTypeReferenceImpl<T>
-
getActualClass
Description copied from interface:CtTypeReferenceGets 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:
getActualClassin interfaceCtTypeReference<T>- Overrides:
getActualClassin classCtTypeReferenceImpl<T>- Returns:
- the Java class or throws a
SpoonClassNotFoundExceptionif the class is not found.
-
it will return the version of the class your
-
getDimensionCount
public int getDimensionCount()Description copied from interface:CtArrayTypeReferenceReturns 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:
getDimensionCountin interfaceCtArrayTypeReference<T>
-
getTypeErasure
Description copied from interface:CtTypeInformationThis method returns a reference to the erased type.For example, this will return
ListforList<String>, orEnumfor the type parameterEin the enum declaration.- Specified by:
getTypeErasurein interfaceCtTypeInformation- Overrides:
getTypeErasurein classCtTypeReferenceImpl<T>- Returns:
- a reference to the erased type
- See Also:
-
clone
Description copied from interface:CtElementClone 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:
clonein interfaceCtArrayTypeReference<T>- Specified by:
clonein interfaceCtElement- Specified by:
clonein interfaceCtReference- Specified by:
clonein interfaceCtTypeReference<T>- Overrides:
clonein classCtTypeReferenceImpl<T>- Returns:
- a clone of this element. All children are cloned, but the parent of the returned clone is set to null.
-
isSimplyQualified
public boolean isSimplyQualified()- Specified by:
isSimplyQualifiedin interfaceCtTypeReference<T>- Overrides:
isSimplyQualifiedin classCtTypeReferenceImpl<T>- Returns:
- false then fully qualified name is printed. true then type simple name is printed.
-
setSimplyQualified
- Specified by:
setSimplyQualifiedin interfaceCtTypeReference<T>- Overrides:
setSimplyQualifiedin 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.DeclarationKindof this instance
-
isGenerics
public boolean isGenerics()Description copied from interface:CtTypeInformationReturns 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:
isGenericsin interfaceCtTypeInformation- Overrides:
isGenericsin classCtTypeReferenceImpl<T>
-