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
Constructors Constructor Description CtWildcardReferenceImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
accept(CtVisitor visitor)
Accepts a visitorCtWildcardReference
clone()
Clone the element which calls this method in a new object.Class<Object>
getActualClass()
Gets the Java runtime class of the referenced type.CtTypeReference<?>
getBoundingType()
A type parameter can have anextends
clause which declare one (CtTypeReference
or more (CtIntersectionTypeReference
references.CtType<Object>
getTypeDeclaration()
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
isWildcard()
<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
-
-
-
-
Method Detail
-
accept
public void accept(CtVisitor visitor)
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
public <T extends CtWildcardReference> T setUpper(boolean upper)
Description copied from interface:CtWildcardReference
Set totrue
to writeextends
clause for bounds types.- Specified by:
setUpper
in interfaceCtWildcardReference
-
setBoundingType
public <T extends CtWildcardReference> T setBoundingType(CtTypeReference<?> superType)
Description copied from interface:CtWildcardReference
Sets theextends
clause of the type parameter.- Specified by:
setBoundingType
in interfaceCtWildcardReference
-
getBoundingType
public CtTypeReference<?> 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
public <T extends CtReference> T setSimpleName(String simplename)
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
public CtWildcardReference 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
public CtType<Object> 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
public Class<Object> 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. For CtTypeReference, useCtTypeReference.getTypeDeclaration()
instead, in order to only stay in the Spoon world and manipulate CtType instead of java.lang.Class.- Specified by:
getActualClass
in interfaceCtTypeReference<Object>
- Overrides:
getActualClass
in classCtTypeParameterReferenceImpl
- Returns:
- the Java class or throws a
SpoonClassNotFoundException
if the class is not found.
-
isWildcard
protected boolean isWildcard()
- Overrides:
isWildcard
in classCtTypeParameterReferenceImpl
-
-