public class ClsFieldImpl extends ClsMemberImpl<PsiFieldStub> implements PsiField, PsiVariableEx, ClsModifierListOwner
ClsElementImpl.InvalidMirrorException
COMPILED_ELEMENT, NEXT_LINE
FLAGS_LOCKED, ICON_PLACEHOLDER
ARRAY_FACTORY, EMPTY_ARRAY
EMPTY_NAVIGATABLE_ELEMENT_ARRAY
EMPTY_NAVIGATION_ITEM_ARRAY
Constructor and Description |
---|
ClsFieldImpl(PsiFieldStub stub) |
Modifier and Type | Method and Description |
---|---|
void |
accept(PsiElementVisitor visitor)
Passes the element to the specified visitor.
|
void |
appendMirrorText(int indentLevel,
java.lang.StringBuilder buffer) |
java.lang.Object |
computeConstantValue()
Calculates and returns the constant value of the variable initializer.
|
java.lang.Object |
computeConstantValue(java.util.Set<PsiVariable> visitedVars) |
PsiElement [] |
getChildren()
Returns the array of children for the PSI element.
|
PsiClass |
getContainingClass()
Returns the class containing the member.
|
javax.swing.Icon |
getElementIcon(int flags) |
PsiExpression |
getInitializer()
Returns the initializer for the variable.
|
PsiModifierList |
getModifierList()
Returns the list of modifiers for the element.
|
PsiElement |
getNavigationElement()
Returns the PSI element which should be used as a navigation target
when navigation to this PSI element is requested.
|
ItemPresentation |
getPresentation() |
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.
|
protected boolean |
isVisibilitySupported() |
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. |
void |
setMirror(TreeElement element) |
java.lang.String |
toString()
toString() should never be presented to the user.
|
getDocComment, getName, getNameIdentifier, setName
getContainingFile, getElementType, getFirstChild, getLastChild, getManager, getNextSibling, getParent, getPrevSibling, getStub, isPhysical
add, addAfter, addBefore, appendText, appendText, checkAdd, checkDelete, copy, delete, findElementAt, findReferenceAt, getChildren, getIndentSize, getLanguage, getMirror, getNode, getStartOffsetInParent, getText, getTextLength, getTextOffset, getTextRange, isValid, isWritable, replace, setMirror, setMirrorCheckingType, setMirrorIfPresent, setMirrors, setMirrors, textMatches, textMatches, textToCharArray
acceptChildren, addRange, addRangeAfter, addRangeBefore, canNavigate, canNavigateToSource, deleteChildRange, findChildByClass, findChildrenByClass, findNotNullChildByClass, getContext, 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
getName, getNameIdentifier
getAnnotation, getAnnotations, getSourceElement, hasAnnotation, hasModifier
getDocComment
setName
getIdentifyingElement
isWritable
public ClsFieldImpl(PsiFieldStub stub)
public PsiElement [] getChildren()
PsiElement
getChildren
in interface PsiElement
getChildren
in class ClsRepositoryPsiElement<PsiFieldStub>
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 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 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 java.lang.Object computeConstantValue()
PsiVariable
computeConstantValue
in interface PsiVariable
public java.lang.Object computeConstantValue(java.util.Set<PsiVariable> visitedVars)
computeConstantValue
in interface PsiVariableEx
public boolean isDeprecated()
PsiDocCommentOwner
true
if the element is marked as deprecated via an annotation or a JavaDoc tag.isDeprecated
in interface PsiDocCommentOwner
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 void appendMirrorText(int indentLevel, java.lang.StringBuilder buffer)
appendMirrorText
in class ClsElementImpl
public void setMirror(TreeElement element) throws ClsElementImpl.InvalidMirrorException
setMirror
in class ClsElementImpl
ClsElementImpl.InvalidMirrorException
public void accept(PsiElementVisitor visitor)
PsiElement
accept
in interface PsiElement
accept
in class PsiElementBase
visitor
- the visitor to pass the element to.public PsiElement getNavigationElement()
PsiElement
this
or substitute a different element if this element
does not have an associated file and offset. (For example, if the source code
of a library is attached to a project, the navigation element for a compiled
library class is its source class.)getNavigationElement
in interface PsiElement
getNavigationElement
in interface PsiTarget
getNavigationElement
in class PsiElementBase
public ItemPresentation getPresentation()
getPresentation
in interface NavigationItem
getPresentation
in class PsiElementBase
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 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)
protected boolean isVisibilitySupported()
isVisibilitySupported
in class ElementBase
public java.lang.String toString()
PsiElement
toString
in interface PsiElement
toString
in class java.lang.Object