public class LightField extends LightElement implements PsiField
Iconable.IconFlags, Iconable.LastComputedIcon
myManager
FLAGS_LOCKED, ICON_PLACEHOLDER
ARRAY_FACTORY, EMPTY_ARRAY
EMPTY_NAVIGATABLE_ELEMENT_ARRAY
ICON_FLAG_IGNORE_MASK, ICON_FLAG_OPEN, ICON_FLAG_READ_STATUS, ICON_FLAG_VISIBILITY
EMPTY_NAVIGATION_ITEM_ARRAY
Constructor and Description |
---|
LightField(PsiManager manager,
PsiField field,
PsiClass containingClass) |
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
computeConstantValue()
Calculates and returns the constant value of the variable initializer.
|
PsiElement |
copy()
Creates a copy of the file containing the PSI element and returns the corresponding
element in the created copy.
|
PsiClass |
getContainingClass()
Returns the class containing the member.
|
PsiDocComment |
getDocComment()
Returns the JavaDoc comment for the element, or
null when the element has no JavaDoc comment. |
PsiExpression |
getInitializer()
Returns the initializer for the variable.
|
PsiModifierList |
getModifierList()
Returns the list of modifiers for the element.
|
java.lang.String |
getName()
Returns the name of the element.
|
PsiIdentifier |
getNameIdentifier()
Returns the identifier declaring the name of the variable.
|
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.
|
PsiType |
getType()
Returns the type of the variable.
|
PsiTypeElement |
getTypeElement()
Returns the type element declaring the type of the variable.
|
SearchScope |
getUseScope()
Returns the scope in which references to this element are searched.
|
boolean |
hasInitializer()
Checks if the variable has an initializer.
|
boolean |
hasModifierProperty(java.lang.String name)
Checks if the element has the specified modifier.
|
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.
|
void |
normalizeDeclaration()
Ensures that the variable declaration is not combined in the same statement with
other declarations.
|
void |
setInitializer(PsiExpression initializer)
Adds initializer to the field declaration or, if
initializer parameter is null,
removes the initializer from the field declaration. |
PsiElement |
setName(java.lang.String name)
Renames the element.
|
java.lang.String |
toString()
toString() should never be presented to the user.
|
accept, add, addAfter, addBefore, checkAdd, checkDelete, delete, findElementAt, getChildren, getContainingFile, 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, getContext, getFirstChild, getLastChild, getOriginalElement, getPresentation, getProject, getReference, getReferences, getResolveScope, navigate, notNullChild, processDeclarations, textContains
buildRowIcon, computeBaseIcon, createLayeredIcon, getAdjustedBaseIcon, getBaseIcon, getElementIcon, getIcon, iconWithVisibilityIfNeeded, isNativeFileType, isVisibilitySupported, 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
getAnnotation, getAnnotations, getSourceElement, hasAnnotation, hasModifier
getIdentifyingElement
getNavigationElement
isWritable
accept, acceptChildren, add, addAfter, addBefore, addRange, addRangeAfter, addRangeBefore, checkAdd, checkDelete, delete, deleteChildRange, findElementAt, findReferenceAt, getChildren, getContainingFile, getContext, 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
getPresentation
canNavigate, canNavigateToSource, navigate
public LightField(PsiManager manager, PsiField field, PsiClass containingClass)
public void setInitializer(PsiExpression initializer) throws IncorrectOperationException
PsiField
initializer
parameter is null,
removes the initializer from the field declaration.setInitializer
in interface PsiField
setInitializer
in interface PsiVariable
initializer
- the initializer to add.IncorrectOperationException
- if the modifications fails for some reason.public SearchScope getUseScope()
PsiElement
getUseScope
in interface PsiElement
getUseScope
in class PsiElementBase
PsiSearchHelper.getUseScope(PsiElement)
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 java.lang.String getName()
PsiNamedElement
getName
in interface JvmField
getName
in interface JvmMember
getName
in interface JvmNamedElement
getName
in interface NavigationItem
getName
in interface PomNamedTarget
getName
in interface PsiField
getName
in interface PsiNamedElement
getName
in class PsiElementBase
Member.getName()
public PsiIdentifier getNameIdentifier()
PsiVariable
getNameIdentifier
in interface PsiField
getNameIdentifier
in interface PsiNameIdentifierOwner
getNameIdentifier
in interface PsiVariable
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 PsiClass getContainingClass()
PsiMember
getContainingClass
in interface JvmMember
getContainingClass
in interface PsiJvmMember
getContainingClass
in interface PsiMember
Member.getDeclaringClass()
public PsiType getType()
PsiVariable
public PsiTypeElement getTypeElement()
PsiVariable
getTypeElement
in interface PsiVariable
public PsiExpression getInitializer()
PsiVariable
getInitializer
in interface PsiVariable
PsiVariable.hasInitializer()
public boolean hasInitializer()
PsiVariable
Checks if the variable has an initializer.
Please note that even when PsiVariable.hasInitializer()
returns true, PsiVariable.getInitializer()
still can return null,
e.g. for implicit initializer in case of enum constant declaration.
hasInitializer
in interface PsiVariable
public void normalizeDeclaration() throws IncorrectOperationException
PsiVariable
int[] a
)
and not in C style (int a[]
).normalizeDeclaration
in interface PsiVariable
IncorrectOperationException
- if the modification fails for some reason.public java.lang.Object computeConstantValue()
PsiVariable
computeConstantValue
in interface PsiVariable
public PsiElement setName(java.lang.String name) throws IncorrectOperationException
PsiNamedElement
setName
in interface PomRenameableTarget<PsiElement>
setName
in interface PsiNamedElement
setName
in interface PsiVariable
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 PsiModifierList getModifierList()
PsiModifierListOwner
getModifierList
in interface PsiModifierListOwner
public boolean hasModifierProperty(java.lang.String name)
PsiModifierListOwner
PsiModifier
class.hasModifierProperty
in interface PsiModifierListOwner
name
- the name of the modifier to check.public java.lang.String getText()
PsiElement
getText
in interface PsiElement
getText
in class LightElement
PsiElement.textMatches(java.lang.CharSequence)
,
PsiElement.textContains(char)
public PsiElement copy()
PsiElement
copy
in interface PsiElement
copy
in class LightElement
public TextRange getTextRange()
PsiElement
getTextRange
in interface PsiElement
getTextRange
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 java.lang.String toString()
PsiElement
toString
in interface PsiElement
toString
in class LightElement