Package spoon.reflect.declaration
Interface CtNamedElement
- All Superinterfaces:
Cloneable,CtElement,CtQueryable,CtVisitable,FactoryAccessor,Serializable,SourcePositionHolder
- All Known Subinterfaces:
CtAnnotationMethod<T>,CtAnnotationType<T>,CtAnonymousExecutable,CtCatchVariable<T>,CtClass<T>,CtConstructor<T>,CtEnum<T>,CtEnumValue<T>,CtExecutable<R>,CtField<T>,CtFormalTypeDeclarer,CtInterface<T>,CtLambda<T>,CtLocalVariable<T>,CtMethod<T>,CtModule,CtPackage,CtParameter<T>,CtRecord,CtRecordComponent,CtResource<T>,CtType<T>,CtTypeMember,CtTypeParameter,CtVariable<T>
- All Known Implementing Classes:
CtAnnotationMethodImpl,CtAnnotationTypeImpl,CtAnonymousExecutableImpl,CtCatchVariableImpl,CtClassImpl,CtConstructorImpl,CtEnumImpl,CtEnumValueImpl,CtExecutableImpl,CtFieldImpl,CtInterfaceImpl,CtLambdaImpl,CtLocalVariableImpl,CtMethodImpl,CtModelImpl.CtRootPackage,CtModuleImpl,CtNamedElementImpl,CtPackageImpl,CtParameterImpl,CtRecordComponentImpl,CtRecordImpl,CtTypeImpl,CtTypeParameterImpl,InvisibleArrayConstructorImpl,ModuleFactory.CtUnnamedModule
Declares an element that has a name (a class, a method, a variable, etc).
Hence, all subclasses of CtNamedElement are in package "declaration".
Note that references don't define elements, hence are not under CtNamedElement
even if they also have methods set/getSimpleName.
-
Method Summary
Modifier and TypeMethodDescriptionclone()Clone the element which calls this method in a new object.Returns the corresponding reference.Returns the simple (unqualified) name of this element.<T extends CtNamedElement>
TsetSimpleName(String simpleName)Sets the simple (unqualified) name of this element.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, setComments, 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.visitor.CtVisitable
acceptMethods inherited from interface spoon.processing.FactoryAccessor
getFactory, setFactory
-
Method Details
-
getSimpleName
String getSimpleName()Returns the simple (unqualified) name of this element. -
setSimpleName
Sets the simple (unqualified) name of this element. -
getReference
CtReference getReference()Returns the corresponding reference. -
clone
CtNamedElement 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.
-