Interface PsiNamedElement

All Superinterfaces:
PsiElement
All Known Subinterfaces:
PsiNameIdentifierOwner

public interface PsiNamedElement extends PsiElement
Represents a declaration which introduces a named entity and can be renamed (for example, a class or a method). References should not implement this interface since they don't usually introduce a new entity.
See Also:
  • com.intellij.model.psi.PsiSymbolDeclaration
  • Field Details

    • EMPTY_ARRAY

      static final PsiNamedElement[] EMPTY_ARRAY
      The empty array of PSI named elements which can be reused to avoid unnecessary allocations.
  • Method Details

    • getName

      @Nullable @NlsSafe @Nullable @NlsSafe String getName()
      Returns the name of the element.
      Returns:
      the element name.
    • setName

      PsiElement setName(@NlsSafe @NotNull @NlsSafe @NotNull String name) throws IncorrectOperationException
      Renames the element.
      Parameters:
      name - the new element name.
      Returns:
      the element corresponding to this element after the renaming (either this or a different element if the renaming caused the element to be replaced).
      Throws:
      IncorrectOperationException - if the modification is not supported or not possible for some reason.