Package spoon.support.reflect.reference
Class CtPackageReferenceImpl
- java.lang.Object
-
- spoon.support.reflect.declaration.CtElementImpl
-
- spoon.support.reflect.reference.CtReferenceImpl
-
- spoon.support.reflect.reference.CtPackageReferenceImpl
-
- All Implemented Interfaces:
Serializable
,Cloneable
,FactoryAccessor
,SourcePositionHolder
,CtElement
,CtPackageReference
,CtReference
,CtQueryable
,CtVisitable
public class CtPackageReferenceImpl extends CtReferenceImpl implements CtPackageReference
- 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
-
-
Constructor Summary
Constructors Constructor Description CtPackageReferenceImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
accept(CtVisitor visitor)
Accepts a visitorCtPackageReference
clone()
Clone the element which calls this method in a new object.protected AnnotatedElement
getActualAnnotatedElement()
Package
getActualPackage()
Gets the package element when available in the class path.CtPackage
getDeclaration()
Gets the package element when available in the source code.String
getQualifiedName()
The qualified name of a CtPackageReference is directly given by its simple name (seeCtPackageReference.getSimpleName()
)boolean
isUnnamedPackage()
Returnstrue
if this is a reference to an unnamed Java package.-
Methods inherited from class spoon.support.reflect.reference.CtReferenceImpl
equals, getSimpleName, setComments, setSimpleName
-
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.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.reference.CtPackageReference
getSimpleName
-
Methods inherited from interface spoon.reflect.visitor.chain.CtQueryable
filterChildren, map, map
-
Methods inherited from interface spoon.reflect.reference.CtReference
setComments, setSimpleName
-
Methods inherited from interface spoon.processing.FactoryAccessor
getFactory, setFactory
-
-
-
-
Method Detail
-
getDeclaration
public CtPackage getDeclaration()
Description copied from interface:CtPackageReference
Gets the package element when available in the source code.- Specified by:
getDeclaration
in interfaceCtPackageReference
- Specified by:
getDeclaration
in interfaceCtReference
- Returns:
- referenced element or null if element is not in the source path (aka input resource).
-
accept
public void accept(CtVisitor visitor)
Description copied from interface:CtVisitable
Accepts a visitor- Specified by:
accept
in interfaceCtVisitable
- Specified by:
accept
in classCtReferenceImpl
-
getActualPackage
public Package getActualPackage()
Description copied from interface:CtPackageReference
Gets the package element when available in the class path.- Specified by:
getActualPackage
in interfaceCtPackageReference
-
getActualAnnotatedElement
protected AnnotatedElement getActualAnnotatedElement()
- Specified by:
getActualAnnotatedElement
in classCtReferenceImpl
-
clone
public CtPackageReference 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 interfaceCtPackageReference
- Specified by:
clone
in interfaceCtReference
- Overrides:
clone
in classCtReferenceImpl
-
getQualifiedName
public String getQualifiedName()
Description copied from interface:CtPackageReference
The qualified name of a CtPackageReference is directly given by its simple name (seeCtPackageReference.getSimpleName()
)- Specified by:
getQualifiedName
in interfaceCtPackageReference
- Returns:
- the fully qualified name of its referenced package
-
isUnnamedPackage
public boolean isUnnamedPackage()
Description copied from interface:CtPackageReference
Returnstrue
if this is a reference to an unnamed Java package. See JLS ยง7.4.2. Unnamed Packages.- Specified by:
isUnnamedPackage
in interfaceCtPackageReference
-
-