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
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.A type parameter can have anextends
clause which declare one (CtTypeReference
or more (CtIntersectionTypeReference
references.Returns theCtType
that 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()
).boolean
isUpper()
Returnstrue
if the bounds are inextends
clause.protected boolean
<T extends CtWildcardReference>
TsetBoundingType(CtTypeReference<?> superType)
Sets theextends
clause of the type parameter.<T extends CtReference>
TsetSimpleName(String simplename)
Sets the name of referenced element.<T extends CtWildcardReference>
TsetUpper(boolean upper)
Set totrue
to writeextends
clause for bounds types.Methods inherited from class spoon.support.reflect.reference.CtTypeParameterReferenceImpl
addActualTypeArgument, getActualAnnotatedElement, getActualTypeArguments, getDeclaration, getTypeErasure, isDefaultBoundingType, isGenerics, isPrimitive, isSimplyQualified, isSubtypeOf, removeActualTypeArgument, setActualTypeArguments, setSimplyQualified
Methods 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, unbox
Methods inherited from class spoon.support.reflect.reference.CtReferenceImpl
equals, getSimpleName, 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
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, getQualifiedName, getTypeErasure, isAnnotationType, isAnonymous, isArray, isClass, isEnum, isGenerics, isInterface, isLocalType, isParameterized, isPrimitive, isSubtypeOf
Methods inherited from interface spoon.reflect.reference.CtTypeParameterReference
getDeclaration, isDefaultBoundingType, setActualTypeArguments
Methods inherited from interface spoon.reflect.reference.CtTypeReference
asCtIntersectionTypeReference, box, canAccess, canAccess, getAccessType, getDeclaringType, getModifiers, getPackage, getSimpleName, getSuperclass, getSuperInterfaces, getTopLevelType, getTypeParameterDeclaration, isSimplyQualified, setDeclaringType, setPackage, setSimplyQualified, unbox
Methods inherited from interface spoon.processing.FactoryAccessor
getFactory, setFactory
-
Constructor Details
-
CtWildcardReferenceImpl
public CtWildcardReferenceImpl()
-
-
Method Details
-
accept
Description copied from interface:CtVisitable
Accepts a visitor- Specified by:
accept
in interfaceCtVisitable
- Overrides:
accept
in classCtTypeParameterReferenceImpl
-
isUpper
public boolean isUpper()Description copied from interface:CtWildcardReference
Returnstrue
if the bounds are inextends
clause.false
means asuper
clause.- Specified by:
isUpper
in interfaceCtWildcardReference
-
setUpper
Description copied from interface:CtWildcardReference
Set totrue
to writeextends
clause for bounds types.- Specified by:
setUpper
in interfaceCtWildcardReference
-
setBoundingType
Description copied from interface:CtWildcardReference
Sets theextends
clause of the type parameter.- Specified by:
setBoundingType
in interfaceCtWildcardReference
-
getBoundingType
Description copied from interface:CtTypeParameterReference
A type parameter can have anextends
clause which declare one (CtTypeReference
or more (CtIntersectionTypeReference
references.// Extends with generics. T extends Interface1 // Intersection type with generics. T extends Interface1 & Interface2
- Specified by:
getBoundingType
in interfaceCtTypeParameterReference
- Specified by:
getBoundingType
in interfaceCtWildcardReference
- Overrides:
getBoundingType
in classCtTypeParameterReferenceImpl
-
setSimpleName
Description copied from interface:CtReference
Sets the name of referenced element.- Specified by:
setSimpleName
in interfaceCtReference
- Specified by:
setSimpleName
in interfaceCtWildcardReference
- Overrides:
setSimpleName
in classCtReferenceImpl
-
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 interfaceCtElement
- Specified by:
clone
in interfaceCtReference
- Specified by:
clone
in interfaceCtTypeParameterReference
- Specified by:
clone
in interfaceCtTypeReference<Object>
- Specified by:
clone
in interfaceCtWildcardReference
- Overrides:
clone
in classCtTypeParameterReferenceImpl
-
getTypeDeclaration
Description copied from interface:CtTypeReference
Returns theCtType
that 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:
getTypeDeclaration
in interfaceCtTypeReference<Object>
- Overrides:
getTypeDeclaration
in 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: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<Object>
- Overrides:
getActualClass
in classCtTypeParameterReferenceImpl
- Returns:
- the Java class or throws a
SpoonClassNotFoundException
if the class is not found.
-
it will return the version of the class your
-
isWildcard
protected boolean isWildcard()- Overrides:
isWildcard
in classCtTypeParameterReferenceImpl
-