public class LightMethod extends LightElement implements PsiMethod
Iconable.IconFlags, Iconable.LastComputedIcon
Modifier and Type | Field and Description |
---|---|
protected PsiClass |
myContainingClass |
protected PsiMethod |
myMethod |
protected PsiSubstitutor |
mySubstitutor |
myManager
FLAGS_LOCKED, ICON_PLACEHOLDER
ARRAY_FACTORY, EMPTY_ARRAY
EMPTY_NAVIGATABLE_ELEMENT_ARRAY
EMPTY_NAVIGATION_ITEM_ARRAY
ICON_FLAG_IGNORE_MASK, ICON_FLAG_OPEN, ICON_FLAG_READ_STATUS, ICON_FLAG_VISIBILITY
Constructor and Description |
---|
LightMethod(PsiClass containingClass,
PsiMethod method,
PsiSubstitutor substitutor) |
LightMethod(PsiManager manager,
PsiMethod method,
PsiClass containingClass) |
LightMethod(PsiManager manager,
PsiMethod method,
PsiClass containingClass,
Language language) |
LightMethod(PsiManager manager,
PsiMethod method,
PsiClass containingClass,
Language language,
PsiSubstitutor substitutor) |
LightMethod(PsiManager manager,
PsiMethod method,
PsiClass containingClass,
PsiSubstitutor substitutor) |
Modifier and Type | Method and Description |
---|---|
void |
accept(PsiElementVisitor visitor)
Passes the element to the specified visitor.
|
PsiElement |
copy()
Creates a copy of the file containing the PSI element and returns the corresponding
element in the created copy.
|
PsiMethod |
findDeepestSuperMethod()
Returns the method in the deepest base superclass or interface of the containing class which
this method overrides or implements.
|
PsiMethod [] |
findDeepestSuperMethods() |
PsiMethod [] |
findSuperMethods()
Searches the superclasses and base interfaces of the containing class to find
the methods which this method overrides or implements.
|
PsiMethod [] |
findSuperMethods(boolean checkAccess)
Searches the superclasses and base interfaces of the containing class to find
the methods which this method overrides or implements, optionally omitting
the accessibility check.
|
PsiMethod [] |
findSuperMethods(PsiClass parentClass)
Searches the superclasses and base interfaces of the specified class to find
the methods which this method can override or implement.
|
java.util.List<MethodSignatureBackedByPsiMethod> |
findSuperMethodSignaturesIncludingStatic(boolean checkAccess)
Searches the superclasses and base interfaces of the containing class to find
static and instance methods with the signature matching the signature of this method.
|
PsiCodeBlock |
getBody()
Returns the body of the method.
|
PsiClass |
getContainingClass()
Returns the class containing the member.
|
PsiFile |
getContainingFile()
Returns the file containing the PSI element.
|
PsiElement |
getContext()
Returns the element which should be used as the parent of this element in a tree up
walk during a resolve operation.
|
PsiDocComment |
getDocComment()
Returns the JavaDoc comment for the element, or
null when the element has no JavaDoc comment. |
javax.swing.Icon |
getElementIcon(int flags) |
HierarchicalMethodSignature |
getHierarchicalMethodSignature() |
PsiModifierList |
getModifierList()
Returns the list of modifiers for the element.
|
java.lang.String |
getName()
Returns the name of the element.
|
PsiIdentifier |
getNameIdentifier()
Returns the name identifier for the method.
|
PsiParameterList |
getParameterList()
Returns the parameter list for the method.
|
ItemPresentation |
getPresentation() |
PsiType |
getReturnType()
Returns the return type of the method.
|
PsiTypeElement |
getReturnTypeElement()
Returns the type element for the return type of the method.
|
MethodSignature |
getSignature(PsiSubstitutor substitutor)
Returns the signature of this method, using the specified substitutor to specify
values of generic type parameters.
|
java.lang.String |
getText()
Returns the text of the PSI element.
|
TextRange |
getTextRange()
Returns the text range in the document occupied by the PSI element.
|
PsiReferenceList |
getThrowsList()
Returns the list of thrown exceptions for the method.
|
PsiTypeParameterList |
getTypeParameterList()
Returns the type parameter list for the element.
|
PsiTypeParameter [] |
getTypeParameters()
Returns the array of type parameters for the element.
|
SearchScope |
getUseScope()
Returns the scope in which references to this element are searched.
|
boolean |
hasModifierProperty(java.lang.String name)
Checks if the element has the specified modifier.
|
boolean |
hasTypeParameters()
Checks if the element has any type parameters.
|
boolean |
isConstructor()
Checks if the method is a constructor.
|
boolean |
isDeprecated()
Returns
true if the element is marked as deprecated via an annotation or a JavaDoc tag. |
boolean |
isEquivalentTo(PsiElement another)
This method shouldn't be called by clients directly, because there are no guarantees of it being symmetric.
|
boolean |
isValid()
Checks if this PSI element is valid.
|
boolean |
isVarArgs()
Checks if the method accepts a variable number of arguments.
|
protected boolean |
isVisibilitySupported() |
PsiElement |
setName(java.lang.String name)
Renames the element.
|
java.lang.String |
toString()
toString() should never be presented to the user.
|
add, addAfter, addBefore, checkAdd, checkDelete, delete, findElementAt, getChildren, getLanguage, getManager, getNavigationElement, getNextSibling, getNode, getParent, getPrevSibling, getStartOffsetInParent, getTextLength, getTextOffset, isPhysical, isWritable, replace, setNavigationElement, textMatches, textMatches, textToCharArray
acceptChildren, addRange, addRangeAfter, addRangeBefore, canNavigate, canNavigateToSource, deleteChildRange, findChildByClass, findChildrenByClass, findNotNullChildByClass, findReferenceAt, getFirstChild, getLastChild, getOriginalElement, getProject, getReference, getReferences, getResolveScope, navigate, notNullChild, processDeclarations, textContains
buildRowIcon, computeBaseIcon, createLayeredIcon, getAdjustedBaseIcon, getBaseIcon, getIcon, iconWithVisibilityIfNeeded, isNativeFileType, overlayIcons, registerIconLayer, transformFlags
changeUserMap, clearUserData, clone, copyCopyableDataTo, copyUserDataTo, getCopyableUserData, getUserData, getUserDataString, getUserMap, isUserDataEmpty, putCopyableUserData, putUserData, putUserDataIfAbsent, replace, setUserMap
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getParameters, getThrowsTypes, hasParameters
getIdentifyingElement
canNavigate, canNavigateToSource, navigate
getAnnotation, getAnnotations, getSourceElement, hasAnnotation, hasModifier
acceptChildren, add, addAfter, addBefore, addRange, addRangeAfter, addRangeBefore, checkAdd, checkDelete, delete, deleteChildRange, findElementAt, findReferenceAt, getChildren, getCopyableUserData, getFirstChild, getLanguage, getLastChild, getManager, getNavigationElement, getNextSibling, getNode, getOriginalElement, getOwnReferences, getParent, getPrevSibling, getProject, getReference, getReferences, getResolveScope, getStartOffsetInParent, getTextLength, getTextOffset, getTextRangeInParent, isPhysical, isWritable, processDeclarations, putCopyableUserData, replace, textContains, textMatches, textMatches, textToCharArray
getUserData, putUserData
isWritable
getNavigationElement
protected final PsiMethod myMethod
protected final PsiClass myContainingClass
protected final PsiSubstitutor mySubstitutor
public LightMethod(PsiClass containingClass, PsiMethod method, PsiSubstitutor substitutor)
public LightMethod(PsiManager manager, PsiMethod method, PsiClass containingClass)
public LightMethod(PsiManager manager, PsiMethod method, PsiClass containingClass, PsiSubstitutor substitutor)
public LightMethod(PsiManager manager, PsiMethod method, PsiClass containingClass, Language language)
public LightMethod(PsiManager manager, PsiMethod method, PsiClass containingClass, Language language, PsiSubstitutor substitutor)
public ItemPresentation getPresentation()
getPresentation
in interface NavigationItem
getPresentation
in class PsiElementBase
public boolean hasTypeParameters()
PsiTypeParameterListOwner
hasTypeParameters
in interface PsiTypeParameterListOwner
public PsiTypeParameter [] getTypeParameters()
PsiTypeParameterListOwner
getTypeParameters
in interface JvmTypeParametersOwner
getTypeParameters
in interface PsiTypeParameterListOwner
GenericDeclaration.getTypeParameters()
public PsiTypeParameterList getTypeParameterList()
PsiTypeParameterListOwner
getTypeParameterList
in interface PsiTypeParameterListOwner
public PsiDocComment getDocComment()
PsiJavaDocumentedElement
null
when the element has no JavaDoc comment.getDocComment
in interface PsiJavaDocumentedElement
public boolean isDeprecated()
PsiDocCommentOwner
true
if the element is marked as deprecated via an annotation or a JavaDoc tag.isDeprecated
in interface PsiDocCommentOwner
public PsiElement setName(java.lang.String name) throws IncorrectOperationException
PsiNamedElement
setName
in interface PomRenameableTarget<PsiElement>
setName
in interface PsiMethod
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.public java.lang.String getName()
PsiNamedElement
getName
in interface JvmMember
getName
in interface JvmMethod
getName
in interface JvmNamedElement
getName
in interface NavigationItem
getName
in interface PomNamedTarget
getName
in interface PsiMethod
getName
in interface PsiNamedElement
getName
in class PsiElementBase
Member.getName()
public HierarchicalMethodSignature getHierarchicalMethodSignature()
getHierarchicalMethodSignature
in interface PsiMethod
public boolean hasModifierProperty(java.lang.String name)
PsiModifierListOwner
PsiModifier
class.hasModifierProperty
in interface PsiModifierListOwner
name
- the name of the modifier to check.public TextRange getTextRange()
PsiElement
getTextRange
in interface PsiElement
getTextRange
in class LightElement
public PsiModifierList getModifierList()
PsiModifierListOwner
getModifierList
in interface PsiMethod
getModifierList
in interface PsiModifierListOwner
public PsiType getReturnType()
PsiMethod
getReturnType
in interface JvmMethod
getReturnType
in interface PsiMethod
Method.getGenericReturnType()
,
Method.getAnnotatedReturnType()
public PsiTypeElement getReturnTypeElement()
PsiMethod
getReturnTypeElement
in interface PsiMethod
public PsiParameterList getParameterList()
PsiMethod
getParameterList
in interface PsiMethod
getParameterList
in interface PsiParameterListOwner
public PsiReferenceList getThrowsList()
PsiMethod
getThrowsList
in interface PsiMethod
public PsiCodeBlock getBody()
PsiMethod
getBody
in interface PsiMethod
getBody
in interface PsiParameterListOwner
public boolean isConstructor()
PsiMethod
isConstructor
in interface JvmMethod
isConstructor
in interface PsiMethod
public boolean isVarArgs()
PsiMethod
public MethodSignature getSignature(PsiSubstitutor substitutor)
PsiMethod
getSignature
in interface PsiMethod
substitutor
- the substitutor.public PsiIdentifier getNameIdentifier()
PsiMethod
getNameIdentifier
in interface PsiMethod
getNameIdentifier
in interface PsiNameIdentifierOwner
public PsiMethod [] findSuperMethods()
PsiMethod
findSuperMethods
in interface PsiMethod
public PsiMethod [] findSuperMethods(boolean checkAccess)
PsiMethod
findSuperMethods
in interface PsiMethod
checkAccess
- if false, the super methods are searched even if this method
is private. If true, an empty result list is returned for private methods.public PsiMethod [] findSuperMethods(PsiClass parentClass)
PsiMethod
findSuperMethods
in interface PsiMethod
parentClass
- the class to search for super methods.public java.util.List<MethodSignatureBackedByPsiMethod> findSuperMethodSignaturesIncludingStatic(boolean checkAccess)
PsiMethod
findSuperMethodSignaturesIncludingStatic
in interface PsiMethod
checkAccess
- if false, the super methods are searched even if this method
is private. If true, an empty result list is returned for private methods.public PsiMethod findDeepestSuperMethod()
PsiMethod
findDeepestSuperMethod
in interface PsiMethod
public PsiMethod [] findDeepestSuperMethods()
findDeepestSuperMethods
in interface PsiMethod
public java.lang.String getText()
PsiElement
getText
in interface PsiElement
getText
in class LightElement
PsiElement.textMatches(java.lang.CharSequence)
,
PsiElement.textContains(char)
public void accept(PsiElementVisitor visitor)
PsiElement
accept
in interface PsiElement
accept
in class LightElement
visitor
- the visitor to pass the element to.public PsiElement copy()
PsiElement
copy
in interface PsiElement
copy
in class LightElement
public boolean isValid()
PsiElement
PsiDocumentManager.commitDocument(com.intellij.openapi.editor.Document)
).
(In this case an attempt to change PSI will result in an exception).
Any access to invalid elements results in PsiInvalidElementAccessException
.
Once invalid, elements can't become valid again.
Elements become invalid in following cases:
PsiElement.delete()
)isValid
in interface PomTarget
isValid
in interface PsiElement
isValid
in class LightElement
PsiUtilCore.ensureValid(PsiElement)
public PsiClass getContainingClass()
PsiMember
getContainingClass
in interface JvmMember
getContainingClass
in interface PsiJvmMember
getContainingClass
in interface PsiMember
Member.getDeclaringClass()
public PsiFile getContainingFile()
PsiElement
getContainingFile
in interface PsiElement
getContainingFile
in class LightElement
public java.lang.String toString()
PsiElement
toString
in interface PsiElement
toString
in class LightElement
protected boolean isVisibilitySupported()
isVisibilitySupported
in class ElementBase
public javax.swing.Icon getElementIcon(int flags)
getElementIcon
in class ElementBase
public boolean isEquivalentTo(PsiElement another)
PsiElement
PsiManager.areElementsEquivalent(PsiElement, PsiElement)
internally, which clients should invoke instead.
Implementations of this method should return true
if the parameter is resolve-equivalent to this
, i.e. it represents
the same entity from the language perspective. See also PsiManager.areElementsEquivalent(PsiElement, PsiElement)
documentation.isEquivalentTo
in interface PsiElement
isEquivalentTo
in class PsiElementBase
public SearchScope getUseScope()
PsiElement
getUseScope
in interface PsiElement
getUseScope
in class PsiElementBase
PsiSearchHelper.getUseScope(PsiElement)
public PsiElement getContext()
PsiElement
getParent()
,
but the context can be overridden for some elements like code fragments (see
JavaCodeFragmentFactory.createCodeBlockCodeFragment(String, PsiElement, boolean)
).getContext
in interface PsiElement
getContext
in class PsiElementBase