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

public interface CtNamedElement extends CtElement
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 Details

    • getSimpleName

      String getSimpleName()
      Returns the simple (unqualified) name of this element.
    • setSimpleName

      <T extends CtNamedElement> T setSimpleName(String simpleName)
      Sets the simple (unqualified) name of this element.
    • getReference

      CtReference getReference()
      Returns the corresponding reference.
    • 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 methods Refactoring.copyType(CtType) and Refactoring.copyMethod(CtMethod) instead which does additional work beyond cloning.
      Specified by:
      clone in interface CtElement