public class PsiPatternVariableImpl extends CompositePsiElement implements PsiPatternVariable, Constants
Iconable.IconFlags, Iconable.LastComputedIcon
JavaElementType.ICodeBlockElementType, JavaElementType.JavaCompositeElementType, JavaElementType.JavaDummyElementType, JavaElementType.TypeTextElementType
JavaDocElementType.JavaDocCompositeElementType, JavaDocElementType.JavaDocLazyElementType
ourHC
EMPTY_ARRAY
FLAGS_LOCKED, ICON_PLACEHOLDER
ARRAY_FACTORY, EMPTY_ARRAY
ICON_FLAG_IGNORE_MASK, ICON_FLAG_OPEN, ICON_FLAG_READ_STATUS, ICON_FLAG_VISIBILITY
ANNOTATION_BIT_SET, CATCH_SECTION_BIT_SET, CLASS_BIT_SET, CLASS_INITIALIZER_BIT_SET, FIELD_BIT_SET, JAVA_CODE_REFERENCE_BIT_SET, METHOD_BIT_SET, NAME_VALUE_PAIR_BIT_SET, PARAMETER_BIT_SET
ANNOTATION_MEMBER_VALUE_BIT_SET, ARRAY_DIMENSION_BIT_SET, CLASS_KEYWORD_BIT_SET, EXPRESSION_BIT_SET, FULL_MEMBER_BIT_SET, IMPORT_STATEMENT_BASE_BIT_SET, INTEGER_LITERALS, JAVA_COMMENT_BIT_SET, JAVA_COMMENT_OR_WHITESPACE_BIT_SET, JAVA_MODULE_STATEMENT_BIT_SET, JAVA_PLAIN_COMMENT_BIT_SET, JAVA_STATEMENT_BIT_SET, KEYWORD_BIT_SET, LITERAL_BIT_SET, MEMBER_BIT_SET, MODIFIER_BIT_SET, OPERATION_BIT_SET, PRIMITIVE_TYPE_BIT_SET, REAL_LITERALS, STRING_LITERALS, TEXT_LITERALS
ABSTRACT_KEYWORD, AND, ANDAND, ANDEQ, ARROW, ASSERT_KEYWORD, ASTERISK, ASTERISKEQ, AT, BOOLEAN_KEYWORD, BREAK_KEYWORD, BYTE_KEYWORD, C_STYLE_COMMENT, CASE_KEYWORD, CATCH_KEYWORD, CHAR_KEYWORD, CHARACTER_LITERAL, CLASS_KEYWORD, COLON, COMMA, CONST_KEYWORD, CONTINUE_KEYWORD, DEFAULT_KEYWORD, DIV, DIVEQ, DO_KEYWORD, DOT, DOUBLE_COLON, DOUBLE_KEYWORD, DOUBLE_LITERAL, ELLIPSIS, ELSE_KEYWORD, END_OF_LINE_COMMENT, ENUM_KEYWORD, EQ, EQEQ, EXCL, EXPORTS_KEYWORD, EXTENDS_KEYWORD, FALSE_KEYWORD, FINAL_KEYWORD, FINALLY_KEYWORD, FLOAT_KEYWORD, FLOAT_LITERAL, FOR_KEYWORD, GE, GOTO_KEYWORD, GT, GTGT, GTGTEQ, GTGTGT, GTGTGTEQ, IDENTIFIER, IF_KEYWORD, IMPLEMENTS_KEYWORD, IMPORT_KEYWORD, INSTANCEOF_KEYWORD, INT_KEYWORD, INTEGER_LITERAL, INTERFACE_KEYWORD, LBRACE, LBRACKET, LE, LONG_KEYWORD, LONG_LITERAL, LPARENTH, LT, LTLT, LTLTEQ, MINUS, MINUSEQ, MINUSMINUS, MODULE_KEYWORD, NATIVE_KEYWORD, NE, NEW_KEYWORD, NULL_KEYWORD, OPEN_KEYWORD, OPENS_KEYWORD, OR, OREQ, OROR, PACKAGE_KEYWORD, PERC, PERCEQ, PLUS, PLUSEQ, PLUSPLUS, PRIVATE_KEYWORD, PROTECTED_KEYWORD, PROVIDES_KEYWORD, PUBLIC_KEYWORD, QUEST, RBRACE, RBRACKET, RECORD_KEYWORD, REQUIRES_KEYWORD, RETURN_KEYWORD, RPARENTH, SEMICOLON, SHORT_KEYWORD, STATIC_KEYWORD, STRICTFP_KEYWORD, STRING_LITERAL, SUPER_KEYWORD, SWITCH_KEYWORD, SYNCHRONIZED_KEYWORD, TEXT_BLOCK_LITERAL, THIS_KEYWORD, THROW_KEYWORD, THROWS_KEYWORD, TILDE, TO_KEYWORD, TRANSIENT_KEYWORD, TRANSITIVE_KEYWORD, TRUE_KEYWORD, TRY_KEYWORD, USES_KEYWORD, VAR_KEYWORD, VOID_KEYWORD, VOLATILE_KEYWORD, WHILE_KEYWORD, WITH_KEYWORD, XOR, XOREQ, YIELD_KEYWORD
BAD_CHARACTER, CODE_FRAGMENT, DUMMY_HOLDER, ERROR_ELEMENT, NEW_LINE_INDENT, WHITE_SPACE
ALL_JAVADOC_TOKENS, DOC_COMMENT_BAD_CHARACTER, DOC_COMMENT_DATA, DOC_COMMENT_END, DOC_COMMENT_LEADING_ASTERISKS, DOC_COMMENT_START, DOC_INLINE_TAG_END, DOC_INLINE_TAG_START, DOC_SPACE, DOC_TAG_NAME, DOC_TAG_VALUE_COMMA, DOC_TAG_VALUE_DOT, DOC_TAG_VALUE_GT, DOC_TAG_VALUE_LPAREN, DOC_TAG_VALUE_LT, DOC_TAG_VALUE_RPAREN, DOC_TAG_VALUE_SHARP_TOKEN, DOC_TAG_VALUE_TOKEN
ANNOTATION, ANNOTATION_ARRAY_INITIALIZER, ANNOTATION_METHOD, ANNOTATION_PARAMETER_LIST, ANONYMOUS_CLASS, ARRAY_ACCESS_EXPRESSION, ARRAY_INITIALIZER_EXPRESSION, ASSERT_STATEMENT, ASSIGNMENT_EXPRESSION, BINARY_EXPRESSION, BLOCK_STATEMENT, BREAK_STATEMENT, CATCH_SECTION, CLASS, CLASS_INITIALIZER, CLASS_OBJECT_ACCESS_EXPRESSION, CODE_BLOCK, CONDITIONAL_EXPRESSION, CONTINUE_STATEMENT, DECLARATION_STATEMENT, DIAMOND_TYPE, DO_WHILE_STATEMENT, DUMMY_ELEMENT, EMPTY_EXPRESSION, EMPTY_STATEMENT, ENUM_CONSTANT, ENUM_CONSTANT_INITIALIZER, EXPORTS_STATEMENT, EXPRESSION_LIST, EXPRESSION_LIST_STATEMENT, EXPRESSION_STATEMENT, EXPRESSION_TEXT, EXTENDS_BOUND_LIST, EXTENDS_LIST, FIELD, FOR_STATEMENT, FOREACH_STATEMENT, IF_STATEMENT, IMPLEMENTS_LIST, IMPORT_LIST, IMPORT_STATEMENT, IMPORT_STATIC_REFERENCE, IMPORT_STATIC_STATEMENT, INSTANCE_OF_EXPRESSION, JAVA_CODE_REFERENCE, LABELED_STATEMENT, LAMBDA_EXPRESSION, LITERAL_EXPRESSION, LOCAL_VARIABLE, MEMBERS, METHOD, METHOD_CALL_EXPRESSION, METHOD_REF_EXPRESSION, MODIFIER_LIST, MODULE, MODULE_REFERENCE, NAME_VALUE_PAIR, NEW_EXPRESSION, OPENS_STATEMENT, PACKAGE_STATEMENT, PARAMETER, PARAMETER_LIST, PARENTH_EXPRESSION, PATTERN_VARIABLE, POLYADIC_EXPRESSION, POSTFIX_EXPRESSION, PREFIX_EXPRESSION, PROVIDES_STATEMENT, PROVIDES_WITH_LIST, RECEIVER_PARAMETER, RECORD_COMPONENT, RECORD_HEADER, REFERENCE_EXPRESSION, REFERENCE_PARAMETER_LIST, REFERENCE_TEXT, REQUIRES_STATEMENT, RESOURCE_EXPRESSION, RESOURCE_LIST, RESOURCE_VARIABLE, RETURN_STATEMENT, STATEMENTS, SUPER_EXPRESSION, SWITCH_EXPRESSION, SWITCH_LABEL_STATEMENT, SWITCH_LABELED_RULE, SWITCH_STATEMENT, SYNCHRONIZED_STATEMENT, THIS_EXPRESSION, THROW_STATEMENT, THROWS_LIST, TRY_STATEMENT, TYPE, TYPE_CAST_EXPRESSION, TYPE_PARAMETER, TYPE_PARAMETER_LIST, TYPE_TEST_PATTERN, TYPE_WITH_CONJUNCTIONS_TEXT, TYPE_WITH_DISJUNCTIONS_TEXT, USES_STATEMENT, WHILE_STATEMENT, YIELD_STATEMENT
ALL_JAVADOC_ELEMENTS, DOC_COMMENT, DOC_INLINE_TAG, DOC_METHOD_OR_FIELD_REF, DOC_PARAMETER_REF, DOC_REFERENCE_HOLDER, DOC_TAG, DOC_TAG_VALUE_ELEMENT, DOC_TYPE_HOLDER
EMPTY_NAVIGATION_ITEM_ARRAY
Constructor and Description |
---|
PsiPatternVariableImpl() |
Modifier and Type | Method and Description |
---|---|
void |
accept(PsiElementVisitor visitor)
Passes the element to the specified visitor.
|
java.lang.Object |
computeConstantValue()
Calculates and returns the constant value of the variable initializer.
|
void |
delete()
Deletes this PSI element from the tree.
|
PsiElement |
getDeclarationScope()
Returns the element (method, lambda expression, foreach statement or catch block) in which the
parameter is declared.
|
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.
|
PsiPattern |
getPattern() |
int |
getTextOffset()
Returns the offset in the file to which the caret should be placed
when performing the navigation to the 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 |
isVarArgs()
Checks if the parameter accepts a variable number of arguments.
|
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 variable declaration statement or, if
initializer
parameter is null, removes initializer from variable. |
PsiIdentifier |
setName(java.lang.String name)
Renames the element.
|
java.lang.String |
toString()
toString() should never be presented to the user.
|
acceptChildren, add, addAfter, addBefore, addRange, addRangeAfter, addRangeBefore, canNavigate, canNavigateToSource, checkAdd, checkDelete, clone, copy, deleteChildRange, findElementAt, findReferenceAt, getChildren, getContainingFile, getContext, getFirstChild, getLanguage, getLastChild, getNavigationElement, getNextSibling, getNode, getOriginalElement, getParent, getPresentation, getPrevSibling, getProject, getReference, getReferences, getResolveScope, isEquivalentTo, isPhysical, isValid, isWritable, navigate, processDeclarations, replace
acceptTree, addChild, addChild, addChildren, addInternal, addLeaf, clearCaches, countChildren, createPsiNoLock, deleteChildInternal, findChildByRole, findChildByRoleAsPsiElement, findChildByType, findChildByType, findChildByType, findChildByType, findLeafElementAt, findPsiChildByType, findPsiChildByType, getCachedLength, getChars, getChildren, getChildrenAsPsiElements, getChildrenAsPsiElements, getChildRole, getChildRole, getFirstChildNode, getLastChildNode, getPsi, getPsi, getText, getTextLength, hc, rawAddChildren, rawAddChildrenWithoutNotifications, rawFirstChild, rawLastChild, rawRemoveAllChildren, removeAllChildren, removeChild, removeRange, replaceAllChildrenToChildrenOf, replaceChild, replaceChildInternal, setPsi, subtreeChanged, textContains, textMatches, textToCharArray
copyElement, equals, getElementType, getManager, getStartOffset, getStartOffsetInParent, getTextRange, getTreeNext, getTreeParent, getTreePrev, invalidate, onInvalidated, rawInsertAfterMe, rawInsertBeforeMe, rawRemove, rawRemoveUpTo, rawRemoveUpToLast, rawReplaceWithList, textMatches, textMatches, textMatches
buildRowIcon, computeBaseIcon, createLayeredIcon, getAdjustedBaseIcon, getBaseIcon, getElementIcon, getIcon, iconWithVisibilityIfNeeded, isNativeFileType, isVisibilitySupported, overlayIcons, registerIconLayer, transformFlags
changeUserMap, clearUserData, copyCopyableDataTo, copyUserDataTo, getCopyableUserData, getUserData, getUserDataString, getUserMap, isUserDataEmpty, putCopyableUserData, putUserData, putUserDataIfAbsent, replace, setUserMap
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getAnnotations
getIdentifyingElement
acceptChildren, add, addAfter, addBefore, addRange, addRangeAfter, addRangeBefore, checkAdd, checkDelete, copy, 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, getTextRange, getTextRangeInParent, isEquivalentTo, isPhysical, isValid, isWritable, processDeclarations, putCopyableUserData, replace, textContains, textMatches, textMatches, textToCharArray
getUserData, putUserData
getNavigationElement
isWritable
canNavigate, canNavigateToSource, navigate
accept
getAnnotation, getSourceElement, hasAnnotation, hasModifier
getCopyableUserData, putCopyableUserData
public PsiIdentifier 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 PsiIdentifier getNameIdentifier()
PsiVariable
getNameIdentifier
in interface PsiNameIdentifierOwner
getNameIdentifier
in interface PsiPatternVariable
getNameIdentifier
in interface PsiVariable
public void accept(PsiElementVisitor visitor)
PsiElement
accept
in interface PsiElement
accept
in class CompositePsiElement
visitor
- the visitor to pass the element to.public PsiPattern getPattern()
getPattern
in interface PsiPatternVariable
public void setInitializer(PsiExpression initializer) throws IncorrectOperationException
PsiVariable
initializer
parameter is null, removes initializer from variable.setInitializer
in interface PsiVariable
initializer
- the initializer to add.IncorrectOperationException
- if the modifications fails, or if this variable does not support initializers (e.g. parameters).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 PsiType getType()
PsiVariable
getType
in interface JvmParameter
getType
in interface PsiParameter
getType
in interface PsiVariable
Parameter.getParameterizedType()
,
Parameter.getAnnotatedType()
public PsiElement getDeclarationScope()
PsiParameter
getDeclarationScope
in interface PsiParameter
public boolean isVarArgs()
PsiParameter
isVarArgs
in interface PsiParameter
public PsiTypeElement getTypeElement()
PsiParameter
getTypeElement
in interface PsiParameter
getTypeElement
in interface PsiPatternVariable
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 java.lang.String getName()
PsiNamedElement
getName
in interface JvmNamedElement
getName
in interface NavigationItem
getName
in interface PomNamedTarget
getName
in interface PsiNamedElement
getName
in interface PsiParameter
getName
in interface PsiPatternVariable
getName
in class CompositePsiElement
public int getTextOffset()
PsiElement
PsiNamedElement
, this should return the offset in the file of the
name identifier.)getTextOffset
in interface PsiElement
getTextOffset
in class TreeElement
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 SearchScope getUseScope()
PsiElement
getUseScope
in interface PsiElement
getUseScope
in class CompositePsiElement
PsiSearchHelper.getUseScope(PsiElement)
public void delete() throws IncorrectOperationException
PsiElement
delete
in interface PsiElement
delete
in class CompositePsiElement
IncorrectOperationException
- if the modification is not supported
or not possible for some reason (for example, the file containing the element is read-only).public java.lang.String toString()
PsiElement
toString
in interface PsiElement
toString
in class CompositePsiElement