Package spoon.support.reflect.reference
Class CtWildcardReferenceImpl
java.lang.Object
spoon.support.reflect.declaration.CtElementImpl
spoon.support.reflect.reference.CtReferenceImpl
spoon.support.reflect.reference.CtTypeReferenceImpl<Object>
spoon.support.reflect.reference.CtTypeParameterReferenceImpl
spoon.support.reflect.reference.CtWildcardReferenceImpl
- All Implemented Interfaces:
Serializable,Cloneable,FactoryAccessor,SourcePositionHolder,CtElement,CtShadowable,CtTypeInformation,CtActualTypeContainer,CtReference,CtTypeParameterReference,CtTypeReference<Object>,CtWildcardReference,CtQueryable,CtVisitable
public class CtWildcardReferenceImpl
extends CtTypeParameterReferenceImpl
implements CtWildcardReference
- See Also:
- Serialized Form
-
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.A type parameter can have anextendsclause which declare one (CtTypeReferenceor more (CtIntersectionTypeReferencereferences.Returns theCtTypethat corresponds to the reference even if the type isn't in the Spoon source path (in this case, the Spoon elements are built with runtime reflection, and the resulting CtType is called a "shadow" class, seeCtShadowable.isShadow()).booleanisUpper()Returnstrueif the bounds are inextendsclause.protected boolean<T extends CtWildcardReference>
TsetBoundingType(CtTypeReference<?> superType)Sets theextendsclause of the type parameter.<T extends CtReference>
TsetSimpleName(String simplename)Sets the name of referenced element.<T extends CtWildcardReference>
TsetUpper(boolean upper)Set totrueto writeextendsclause for bounds types.Methods inherited from class spoon.support.reflect.reference.CtTypeParameterReferenceImpl
addActualTypeArgument, getActualAnnotatedElement, getActualTypeArguments, getDeclaration, getTypeErasure, isDefaultBoundingType, isGenerics, isPrimitive, isSimplyQualified, isSubtypeOf, removeActualTypeArgument, setActualTypeArguments, setSimplyQualifiedMethods inherited from class spoon.support.reflect.reference.CtTypeReferenceImpl
asCtIntersectionTypeReference, box, canAccess, canAccess, findClass, getAccessType, getAllExecutables, getAllFields, getDeclaredExecutables, getDeclaredField, getDeclaredFields, getDeclaredOrInheritedField, getDeclaringType, getModifiers, getPackage, getQualifiedName, getSuperclass, getSuperInterfaces, getTopLevelType, getTypeParameterDeclaration, isAnnotationType, isAnonymous, isArray, isClass, isEnum, isInterface, isLocalType, isParameterized, isShadow, setDeclaringType, setPackage, setShadow, unboxMethods inherited from class spoon.support.reflect.reference.CtReferenceImpl
equals, getSimpleName, 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, removeActualTypeArgumentMethods 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, getQualifiedName, getTypeErasure, isAnnotationType, isAnonymous, isArray, isClass, isEnum, isGenerics, isInterface, isLocalType, isParameterized, isPrimitive, isSubtypeOfMethods inherited from interface spoon.reflect.reference.CtTypeParameterReference
getDeclaration, isDefaultBoundingType, setActualTypeArgumentsMethods inherited from interface spoon.reflect.reference.CtTypeReference
asCtIntersectionTypeReference, box, canAccess, canAccess, getAccessType, getDeclaringType, getModifiers, getPackage, getSimpleName, getSuperclass, getSuperInterfaces, getTopLevelType, getTypeParameterDeclaration, isSimplyQualified, setDeclaringType, setPackage, setSimplyQualified, unboxMethods inherited from interface spoon.processing.FactoryAccessor
getFactory, setFactory
-
Constructor Details
-
CtWildcardReferenceImpl
public CtWildcardReferenceImpl()
-
-
Method Details
-
accept
Description copied from interface:CtVisitableAccepts a visitor- Specified by:
acceptin interfaceCtVisitable- Overrides:
acceptin classCtTypeParameterReferenceImpl
-
isUpper
public boolean isUpper()Description copied from interface:CtWildcardReferenceReturnstrueif the bounds are inextendsclause.falsemeans asuperclause.- Specified by:
isUpperin interfaceCtWildcardReference
-
setUpper
Description copied from interface:CtWildcardReferenceSet totrueto writeextendsclause for bounds types.- Specified by:
setUpperin interfaceCtWildcardReference
-
setBoundingType
Description copied from interface:CtWildcardReferenceSets theextendsclause of the type parameter.- Specified by:
setBoundingTypein interfaceCtWildcardReference
-
getBoundingType
Description copied from interface:CtTypeParameterReferenceA type parameter can have anextendsclause which declare one (CtTypeReferenceor more (CtIntersectionTypeReferencereferences.// Extends with generics. T extends Interface1 // Intersection type with generics. T extends Interface1 & Interface2- Specified by:
getBoundingTypein interfaceCtTypeParameterReference- Specified by:
getBoundingTypein interfaceCtWildcardReference- Overrides:
getBoundingTypein classCtTypeParameterReferenceImpl
-
setSimpleName
Description copied from interface:CtReferenceSets the name of referenced element.- Specified by:
setSimpleNamein interfaceCtReference- Specified by:
setSimpleNamein interfaceCtWildcardReference- Overrides:
setSimpleNamein classCtReferenceImpl
-
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 interfaceCtElement- Specified by:
clonein interfaceCtReference- Specified by:
clonein interfaceCtTypeParameterReference- Specified by:
clonein interfaceCtTypeReference<Object>- Specified by:
clonein interfaceCtWildcardReference- Overrides:
clonein classCtTypeParameterReferenceImpl
-
getTypeDeclaration
Description copied from interface:CtTypeReferenceReturns theCtTypethat corresponds to the reference even if the type isn't in the Spoon source path (in this case, the Spoon elements are built with runtime reflection, and the resulting CtType is called a "shadow" class, seeCtShadowable.isShadow()).- Specified by:
getTypeDeclarationin interfaceCtTypeReference<Object>- Overrides:
getTypeDeclarationin classCtTypeParameterReferenceImpl- Returns:
- the type declaration that corresponds to the reference or null if the reference points to a class that is not in the classpath.
-
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<Object>- Overrides:
getActualClassin classCtTypeParameterReferenceImpl- Returns:
- the Java class or throws a
SpoonClassNotFoundExceptionif the class is not found.
-
it will return the version of the class your
-
isWildcard
protected boolean isWildcard()- Overrides:
isWildcardin classCtTypeParameterReferenceImpl
-