public class PsiFieldImpl extends JavaStubPsiElement<PsiFieldStub> implements PsiField, PsiVariableEx, Queryable
Queryable.Contributor, Queryable.PrintInfo, Queryable.UtilCREATION_TRACE, ourTraceStubAstBindingFLAGS_LOCKED, ICON_PLACEHOLDERARRAY_FACTORY, EMPTY_ARRAYEMPTY_NAVIGATABLE_ELEMENT_ARRAYEMPTY_NAVIGATION_ITEM_ARRAY| Modifier | Constructor and Description |
|---|---|
|
PsiFieldImpl(ASTNode node) |
|
PsiFieldImpl(PsiFieldStub stub) |
protected |
PsiFieldImpl(PsiFieldStub stub,
IStubElementType type) |
| Modifier and Type | Method and Description |
|---|---|
void |
accept(PsiElementVisitor visitor)
Passes the element to the specified visitor.
|
protected java.lang.Object |
clone() |
java.lang.Object |
computeConstantValue()
Calculates and returns the constant value of the variable initializer.
|
java.lang.Object |
computeConstantValue(java.util.Set<PsiVariable> visitedVars) |
PsiClass |
getContainingClass()
Returns the class containing the member.
|
PsiElement |
getContext()
Returns the element which should be used as the parent of this element in a tree up
walk during a resolve operation.
|
PsiExpression |
getDetachedInitializer() |
PsiDocComment |
getDocComment()
Returns the JavaDoc comment for the element, or
null when the element has no JavaDoc comment. |
javax.swing.Icon |
getElementIcon(int flags) |
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.
|
CompositeElement |
getNode()
Ensures this element is AST-based.
|
PsiElement |
getOriginalElement()
Returns the PSI element which corresponds to this element and belongs to
either the project source path or class path.
|
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.
|
boolean |
processDeclarations(PsiScopeProcessor processor,
ResolveState state,
PsiElement lastParent,
PsiElement place)
Passes the declarations contained in this PSI element and its children
for processing to the specified scope processor.
|
void |
putInfo(java.util.Map<java.lang.String,java.lang.String> info) |
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.
|
void |
subtreeChanged() |
java.lang.String |
toString()
toString() should never be presented to the user.
|
acceptChildren, add, addAfter, addBefore, calcTreeElement, checkAdd, cloneImpl, delete, deleteChildRange, getChildren, getLanguage, getTextOffset, replacegetContainingFile, getElementType, getGreenStub, getManager, getParent, getParentByStub, getParentByTree, getProject, getRequiredStubOrPsiChild, getStub, getStubOrPsiChild, getStubOrPsiChildren, getStubOrPsiChildren, getStubOrPsiChildren, getStubOrPsiChildren, getStubOrPsiParentOfType, isPhysical, isValid, isWritable, setNode, setSubstrateRefaddInternal, addRange, addRangeAfter, addRangeBefore, checkDelete, copy, deleteChildInternal, findChildByFilter, findChildByType, findChildByType, findChildrenByType, findChildrenByType, findChildrenByType, findChildrenByType, findElementAt, findLastChildByType, findNotNullChildByType, findNotNullChildByType, getCopyableUserData, getFirstChild, getLastChild, getNextSibling, getPrevSibling, getStartOffsetInParent, getText, getTextLength, getTextRange, putCopyableUserData, replaceChildInternal, textContains, textMatches, textToCharArraycanNavigate, canNavigateToSource, findChildByClass, findChildrenByClass, findNotNullChildByClass, findReferenceAt, getNavigationElement, getReference, getReferences, getResolveScope, navigate, notNullChild, textMatchesbuildRowIcon, computeBaseIcon, createLayeredIcon, getAdjustedBaseIcon, getBaseIcon, getIcon, iconWithVisibilityIfNeeded, isNativeFileType, overlayIcons, registerIconLayer, transformFlagschangeUserMap, clearUserData, copyCopyableDataTo, copyUserDataTo, getUserData, getUserDataString, getUserMap, isUserDataEmpty, putUserData, putUserDataIfAbsent, replace, setUserMapequals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetAnnotation, getAnnotations, getSourceElement, hasAnnotation, hasModifiergetIdentifyingElementgetNavigationElementisWritablegetElementType, getStubpublic PsiFieldImpl(PsiFieldStub stub)
protected PsiFieldImpl(PsiFieldStub stub, IStubElementType type)
public PsiFieldImpl(ASTNode node)
public void subtreeChanged()
subtreeChanged in class ASTDelegatePsiElementprotected java.lang.Object clone()
clone in class JavaStubPsiElement<PsiFieldStub>public PsiClass getContainingClass()
PsiMembergetContainingClass in interface JvmMembergetContainingClass in interface PsiJvmMembergetContainingClass in interface PsiMemberMember.getDeclaringClass()public PsiElement getContext()
PsiElementgetParent(),
but the context can be overridden for some elements like code fragments (see
JavaCodeFragmentFactory.createCodeBlockCodeFragment(String, PsiElement, boolean)).getContext in interface PsiElementgetContext in class StubBasedPsiElementBase<PsiFieldStub>public CompositeElement getNode()
StubBasedPsiElementBasegetNode in interface PsiElementgetNode in class StubBasedPsiElementBase<PsiFieldStub>StubBasedPsiElementBase.getStub() will return null.public PsiIdentifier getNameIdentifier()
PsiVariablegetNameIdentifier in interface PsiFieldgetNameIdentifier in interface PsiNameIdentifierOwnergetNameIdentifier in interface PsiVariablepublic java.lang.String getName()
PsiNamedElementgetName in interface JvmFieldgetName in interface JvmMembergetName in interface JvmNamedElementgetName in interface NavigationItemgetName in interface PomNamedTargetgetName in interface PsiFieldgetName in interface PsiNamedElementgetName in class PsiElementBaseMember.getName()public PsiElement setName(java.lang.String name) throws IncorrectOperationException
PsiNamedElementsetName in interface PomRenameableTarget<PsiElement>setName in interface PsiNamedElementsetName in interface PsiVariablename - 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 PsiType getType()
PsiVariablepublic PsiTypeElement getTypeElement()
PsiVariablegetTypeElement in interface PsiVariablepublic PsiModifierList getModifierList()
PsiModifierListOwnergetModifierList in interface PsiModifierListOwnerpublic boolean hasModifierProperty(java.lang.String name)
PsiModifierListOwnerPsiModifier class.hasModifierProperty in interface PsiModifierListOwnername - the name of the modifier to check.public PsiExpression getInitializer()
PsiVariablegetInitializer in interface PsiVariablePsiVariable.hasInitializer()public PsiExpression getDetachedInitializer()
public boolean hasInitializer()
PsiVariableChecks 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 PsiVariablepublic javax.swing.Icon getElementIcon(int flags)
getElementIcon in class ElementBasepublic java.lang.Object computeConstantValue()
PsiVariablecomputeConstantValue in interface PsiVariablepublic java.lang.Object computeConstantValue(java.util.Set<PsiVariable> visitedVars)
computeConstantValue in interface PsiVariableExpublic boolean isDeprecated()
PsiDocCommentOwnertrue if the element is marked as deprecated via an annotation or a JavaDoc tag.isDeprecated in interface PsiDocCommentOwnerpublic PsiDocComment getDocComment()
PsiJavaDocumentedElementnull when the element has no JavaDoc comment.getDocComment in interface PsiJavaDocumentedElementpublic void normalizeDeclaration()
throws IncorrectOperationException
PsiVariableint[] a)
and not in C style (int a[]).normalizeDeclaration in interface PsiVariableIncorrectOperationException - if the modification fails for some reason.public void accept(PsiElementVisitor visitor)
PsiElementaccept in interface PsiElementaccept in class PsiElementBasevisitor - the visitor to pass the element to.public boolean processDeclarations(PsiScopeProcessor processor, ResolveState state, PsiElement lastParent, PsiElement place)
PsiElementprocessDeclarations in interface PsiElementprocessDeclarations in class PsiElementBaseprocessor - the processor receiving the declarations.lastParent - the child of this element has been processed during the previous
step of the tree up walk (declarations under this element do not need
to be processed again)place - the original element from which the tree up walk was initiated.public java.lang.String toString()
PsiElementtoString in interface PsiElementtoString in class java.lang.Objectpublic PsiElement getOriginalElement()
PsiElementthis or substitute a different element if this element does
not belong to the source path or class path. (For example, the original
element for a library source file is the corresponding compiled class file.)getOriginalElement in interface PsiElementgetOriginalElement in class PsiElementBasepublic ItemPresentation getPresentation()
getPresentation in interface NavigationItemgetPresentation in class PsiElementBasepublic void setInitializer(PsiExpression initializer) throws IncorrectOperationException
PsiFieldinitializer parameter is null,
removes the initializer from the field declaration.setInitializer in interface PsiFieldsetInitializer in interface PsiVariableinitializer - the initializer to add.IncorrectOperationException - if the modifications fails for some reason.public boolean isEquivalentTo(PsiElement another)
PsiElementPsiManager.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 PsiElementisEquivalentTo in class PsiElementBasepublic SearchScope getUseScope()
PsiElementgetUseScope in interface PsiElementgetUseScope in class PsiElementBasePsiSearchHelper.getUseScope(PsiElement)public void putInfo(java.util.Map<java.lang.String,java.lang.String> info)
protected boolean isVisibilitySupported()
isVisibilitySupported in class ElementBase