public interface PsiReference extends PsiSymbolReference
 Generally returned from PsiElement.getReferences() and PsiReferenceService.getReferences(com.intellij.psi.PsiElement, com.intellij.psi.PsiReferenceService.Hints),
 but may be contributed to some elements by third party plugins via PsiReferenceContributor.
| Modifier and Type | Field and Description | 
|---|---|
static ArrayFactory<PsiReference> | 
ARRAY_FACTORY  | 
static PsiReference[] | 
EMPTY_ARRAY  | 
| Modifier and Type | Method and Description | 
|---|---|
PsiElement | 
bindToElement(PsiElement element)
Changes the reference so that it starts to point to the specified element. 
 | 
java.lang.String | 
getCanonicalText()
Returns the name of the reference target element which does not depend on import statements
 and other context (for example, the full-qualified name of the class if the reference targets
 a Java class). 
 | 
PsiElement | 
getElement()
Returns the underlying (referencing) element of the reference. 
 | 
TextRange | 
getRangeInElement()
Returns the part of the underlying element which serves as a reference, or the complete
 text range of the element if the entire element is a reference. 
 | 
default java.lang.Object [] | 
getVariants()
Returns the array of String,  
PsiElement and/or LookupElement
 instances representing all identifiers that are visible at the location of the reference. | 
PsiElement | 
handleElementRename(java.lang.String newElementName)
Called when the reference target element has been renamed, in order to change the reference
 text according to the new name. 
 | 
boolean | 
isReferenceTo(PsiElement element)
Checks if the reference targets the specified element. 
 | 
boolean | 
isSoft()
Returns  
false if the underlying element is guaranteed to be a reference, or true
 if the underlying element is a possible reference which should not be reported as
 an error if it fails to resolve. | 
PsiElement | 
resolve()
Returns the element which is the target of the reference. 
 | 
default java.util.Collection<? extends SymbolResolveResult> | 
resolveReference()  | 
default boolean | 
resolvesTo(Symbol target)
Default implementation checks results from  
SymbolReference.resolveReference(). | 
getAbsoluteRangestatic final PsiReference[] EMPTY_ARRAY
static final ArrayFactory<PsiReference> ARRAY_FACTORY
PsiElement getElement()
getElement in interface PsiSymbolReferenceTextRange getRangeInElement()
PsiElement text: qualified.LongName PsiReferences: [Ref1---]X[Ref2--]where
Ref1 would resolve to a "namespace" and Ref2 to an "element".getRangeInElement in interface PsiSymbolReferencePsiElement resolve()
null if it was not possible to resolve the reference to a valid target.PsiPolyVariantReference.multiResolve(boolean)java.lang.String getCanonicalText()
PsiElement handleElementRename(java.lang.String newElementName) throws IncorrectOperationException
newElementName - the new name of the target element.IncorrectOperationException - if the rename cannot be handled for some reason.PsiElement bindToElement(PsiElement element) throws IncorrectOperationException
element - the element which should become the target of the reference.IncorrectOperationException - if the rebind cannot be handled for some reason.boolean isReferenceTo(PsiElement element)
element - the element to check target for.true if the reference targets that element, false otherwise.default java.lang.Object [] getVariants()
PsiElement and/or LookupElement
 instances representing all identifiers that are visible at the location of the reference. The contents
 of the returned array is used to build the lookup list for basic code completion. (The list
 of visible identifiers may not be filtered by the completion prefix string - the
 filtering is performed later by the IDE.)
 This method is default since 2018.3.
boolean isSoft()
false if the underlying element is guaranteed to be a reference, or true
 if the underlying element is a possible reference which should not be reported as
 an error if it fails to resolve. For example, a text in an XML file which looks
 like a full-qualified Java class name is a soft reference.true if the reference is soft, false otherwise.default java.util.Collection<? extends SymbolResolveResult> resolveReference()
resolveReference in interface SymbolReferencedefault boolean resolvesTo(Symbol target)
SymbolReferenceSymbolReference.resolveReference().
 Override this method to skip actual resolution if this reference cannot ever resolve to this target.resolvesTo in interface SymbolReference