public interface PsiClass extends PsiNameIdentifierOwner, PsiModifierListOwner, PsiDocCommentOwner, PsiTypeParameterListOwner, PsiQualifiedNamedElement, PsiTarget, PomRenameableTarget<PsiElement>, JvmClass
PsiClassOwner.getClasses()
Iconable.IconFlags, Iconable.LastComputedIcon
Modifier and Type | Field and Description |
---|---|
static ArrayFactory<PsiClass> |
ARRAY_FACTORY |
static PsiClass [] |
EMPTY_ARRAY
The empty array of PSI classes which can be reused to avoid unnecessary allocations.
|
EMPTY_NAVIGATABLE_ELEMENT_ARRAY
EMPTY_NAVIGATION_ITEM_ARRAY
ICON_FLAG_IGNORE_MASK, ICON_FLAG_OPEN, ICON_FLAG_READ_STATUS, ICON_FLAG_VISIBILITY
Modifier and Type | Method and Description |
---|---|
PsiField |
findFieldByName(java.lang.String name,
boolean checkBases)
Searches the class (and optionally its superclasses) for the field with the specified name.
|
PsiClass |
findInnerClassByName(java.lang.String name,
boolean checkBases)
Searches the class (and optionally its superclasses) for the inner class with the specified name.
|
PsiMethod |
findMethodBySignature(PsiMethod patternMethod,
boolean checkBases)
Searches the class (and optionally its superclasses) for the method with
the signature matching the signature of the specified method.
|
java.util.List<Pair<PsiMethod,PsiSubstitutor>> |
findMethodsAndTheirSubstitutorsByName(java.lang.String name,
boolean checkBases)
Searches the class (and optionally its superclasses) for the methods with the specified name
and returns the methods along with their substitutors.
|
default JvmMethod [] |
findMethodsByName(java.lang.String methodName) |
PsiMethod [] |
findMethodsByName(java.lang.String name,
boolean checkBases)
Searches the class (and optionally its superclasses) for the methods with the specified name.
|
PsiMethod [] |
findMethodsBySignature(PsiMethod patternMethod,
boolean checkBases)
Searches the class (and optionally its superclasses) for the methods with the signature
matching the signature of the specified method.
|
PsiField [] |
getAllFields()
Returns the list of fields in the class and all its superclasses.
|
PsiClass [] |
getAllInnerClasses()
Returns the list of inner classes for the class and all its superclasses.
|
PsiMethod [] |
getAllMethods()
Returns the list of methods in the class and all its superclasses.
|
java.util.List<Pair<PsiMethod,PsiSubstitutor>> |
getAllMethodsAndTheirSubstitutors()
Returns the list of methods in the class and all its superclasses, along with their
substitutors.
|
default JvmClassKind |
getClassKind() |
PsiMethod [] |
getConstructors()
Returns the list of constructors for the class.
|
PsiClass |
getContainingClass()
For an inner class, returns its containing class.
|
PsiReferenceList |
getExtendsList()
Returns the list of classes that this class or interface extends.
|
PsiClassType [] |
getExtendsListTypes()
Returns the list of class types for the classes that this class or interface extends.
|
PsiField [] |
getFields()
Returns the list of fields in the class.
|
PsiReferenceList |
getImplementsList()
Returns the list of interfaces that this class implements.
|
PsiClassType [] |
getImplementsListTypes()
Returns the list of class types for the interfaces that this class implements.
|
PsiClassInitializer [] |
getInitializers()
Returns the list of class initializers for the class.
|
PsiClass [] |
getInnerClasses()
Returns the list of inner classes for the class.
|
PsiClass [] |
getInterfaces()
Returns the list of interfaces implemented by the class, or extended by the interface.
|
default JvmReferenceType [] |
getInterfaceTypes() |
PsiElement |
getLBrace()
Returns the token representing the opening curly brace of the class.
|
PsiMethod [] |
getMethods()
Returns the list of methods in the class.
|
PsiIdentifier |
getNameIdentifier()
Returns the name identifier of the class.
|
java.lang.String |
getQualifiedName()
Returns the fully qualified name of the class.
|
PsiElement |
getRBrace()
Returns the token representing the closing curly brace of the class.
|
default PsiRecordComponent [] |
getRecordComponents() |
default PsiRecordHeader |
getRecordHeader() |
PsiElement |
getScope()
Returns the PSI member in which the class has been declared (for example,
the method containing the anonymous inner class, or the file containing a regular
class, or the class owning a type parameter).
|
PsiClass |
getSuperClass()
Returns the base class of this class.
|
default JvmReferenceType |
getSuperClassType() |
PsiClass [] |
getSupers()
Returns the list of classes and interfaces extended or implemented by the class.
|
PsiClassType [] |
getSuperTypes()
Returns the list of class types for the classes and interfaces extended or
implemented by the class.
|
java.util.Collection<HierarchicalMethodSignature> |
getVisibleSignatures()
Returns the hierarchical signatures for all methods in the specified class and
its superclasses and superinterfaces.
|
boolean |
isAnnotationType()
Checks if the class is an annotation type.
|
boolean |
isEnum()
Checks if the class is an enumeration.
|
boolean |
isInheritor(PsiClass baseClass,
boolean checkDeep)
Checks if this class is an inheritor of the specified base class.
|
boolean |
isInheritorDeep(PsiClass baseClass,
PsiClass classToByPass)
Checks if this class is a deep inheritor of the specified base class possibly bypassing a class
when checking inheritance chain.
|
boolean |
isInterface()
Checks if the class is an interface.
|
default boolean |
isRecord()
Checks if the class is a record.
|
PsiElement |
setName(java.lang.String name)
Renames the element.
|
getIdentifyingElement
isDeprecated
getDocComment
getTypeParameterList, getTypeParameters, hasTypeParameters
getName, getPresentation
canNavigate, canNavigateToSource, navigate
getAnnotation, getAnnotations, getSourceElement, hasAnnotation, hasModifier
getModifierList, hasModifierProperty
accept, acceptChildren, add, addAfter, addBefore, addRange, addRangeAfter, addRangeBefore, checkAdd, checkDelete, copy, delete, deleteChildRange, findElementAt, findReferenceAt, getChildren, getContainingFile, getContext, getCopyableUserData, getFirstChild, getLanguage, getLastChild, getManager, getNavigationElement, getNextSibling, getNode, getOriginalElement, getOwnReferences, getParent, getPrevSibling, getProject, getReference, getReferences, getResolveScope, getStartOffsetInParent, getText, getTextLength, getTextOffset, getTextRange, getTextRangeInParent, getUseScope, isEquivalentTo, isPhysical, isValid, isWritable, processDeclarations, putCopyableUserData, replace, textContains, textMatches, textMatches, textToCharArray, toString
getUserData, putUserData
getName
getNavigationElement
isWritable
getName
static final PsiClass [] EMPTY_ARRAY
static final ArrayFactory<PsiClass> ARRAY_FACTORY
java.lang.String getQualifiedName()
getQualifiedName
in interface JvmClass
getQualifiedName
in interface PsiQualifiedNamedElement
Class.getCanonicalName()
boolean isInterface()
boolean isAnnotationType()
boolean isEnum()
default boolean isRecord()
PsiReferenceList getExtendsList()
PsiReferenceList getImplementsList()
PsiClassType [] getExtendsListTypes()
PsiClassType [] getImplementsListTypes()
PsiClass getSuperClass()
PsiClass [] getInterfaces()
PsiClass [] getSupers()
PsiClassType [] getSuperTypes()
PsiField [] getFields()
PsiMethod [] getMethods()
getMethods
in interface JvmClass
Class.getDeclaredMethods()
,
Class.getDeclaredConstructors()
PsiMethod [] getConstructors()
PsiClass [] getInnerClasses()
getInnerClasses
in interface JvmClass
Class.getDeclaredClasses()
PsiClassInitializer [] getInitializers()
PsiField [] getAllFields()
PsiMethod [] getAllMethods()
PsiClass [] getAllInnerClasses()
PsiField findFieldByName(java.lang.String name, boolean checkBases)
name
- the name of the field to find.checkBases
- if true, the field is also searched in the base classes of the class.PsiMethod findMethodBySignature(PsiMethod patternMethod, boolean checkBases)
patternMethod
- the method used as a pattern for the search.checkBases
- if true, the method is also searched in the base classes of the class.PsiMethod [] findMethodsBySignature(PsiMethod patternMethod, boolean checkBases)
patternMethod
- the method used as a pattern for the search.checkBases
- if true, the method is also searched in the base classes of the class.default JvmMethod [] findMethodsByName(java.lang.String methodName)
findMethodsByName
in interface JvmClass
Class.getDeclaredMethod(java.lang.String, java.lang.Class<?>...)
PsiMethod [] findMethodsByName(java.lang.String name, boolean checkBases)
name
- the name of the methods to find.checkBases
- if true, the methods are also searched in the base classes of the class.java.util.List<Pair<PsiMethod,PsiSubstitutor>> findMethodsAndTheirSubstitutorsByName(java.lang.String name, boolean checkBases)
name
- the name of the methods to find.checkBases
- if true, the methods are also searched in the base classes of the class.java.util.List<Pair<PsiMethod,PsiSubstitutor>> getAllMethodsAndTheirSubstitutors()
PsiClass findInnerClassByName(java.lang.String name, boolean checkBases)
name
- the name of the inner class to find.checkBases
- if true, the inner class is also searched in the base classes of the class.PsiElement getLBrace()
PsiElement getRBrace()
PsiIdentifier getNameIdentifier()
getNameIdentifier
in interface PsiNameIdentifierOwner
PsiElement getScope()
boolean isInheritor(PsiClass baseClass, boolean checkDeep)
ClassInheritorsSearch
may return classes that are inheritors in broader, e.g. in ejb sense, but not in java sense.baseClass
- the base class to check the inheritance.checkDeep
- if false, only direct inheritance is checked; if true, the base class is
searched in the entire inheritance chainboolean isInheritorDeep(PsiClass baseClass, PsiClass classToByPass)
ClassInheritorsSearch
may return classes that are inheritors in broader, e.g. in ejb sense, but not in java sense.baseClass
- the base class to check the inheritance.
searched in the entire inheritance chainclassToByPass
- class to bypass the inheritance check forPsiClass getContainingClass()
getContainingClass
in interface JvmMember
getContainingClass
in interface PsiJvmMember
getContainingClass
in interface PsiMember
Member.getDeclaringClass()
java.util.Collection<HierarchicalMethodSignature> getVisibleSignatures()
PsiElement setName(java.lang.String name) throws IncorrectOperationException
PsiNamedElement
setName
in interface PomRenameableTarget<PsiElement>
setName
in interface PsiNamedElement
name
- the new element name.this
or a different element if the rename caused the element to be replaced).IncorrectOperationException
- if the modification is not supported or not possible for some reason.default JvmClassKind getClassKind()
getClassKind
in interface JvmClass
default JvmReferenceType getSuperClassType()
getSuperClassType
in interface JvmClass
null
if this class is an interface or represents Object
Class.getSuperclass()
,
Class.getGenericSuperclass()
,
Class.getAnnotatedSuperclass()
default JvmReferenceType [] getInterfaceTypes()
getInterfaceTypes
in interface JvmClass
Class.getInterfaces()
,
Class.getAnnotatedInterfaces()
,
Class.getGenericInterfaces()
default PsiRecordComponent [] getRecordComponents()
default PsiRecordHeader getRecordHeader()