Class SymbolReference<S extends ResolvedDeclaration>
- java.lang.Object
-
- com.github.javaparser.resolution.model.SymbolReference<S>
-
public class SymbolReference<S extends ResolvedDeclaration> extends java.lang.ObjectA reference to a symbol. It can solved or not solved. If solved the corresponding declaration will be provided.
-
-
Field Summary
Fields Modifier and Type Field Description private ScorrespondingDeclaration
-
Constructor Summary
Constructors Modifier Constructor Description privateSymbolReference(S correspondingDeclaration)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static <I extends ResolvedDeclaration,O extends ResolvedDeclaration>
SymbolReference<O>adapt(SymbolReference<I> ref, java.lang.Class<O> clazz)Adapt aSymbolReferenceinto anotherSymbolReference.SgetCorrespondingDeclaration()The corresponding declaration.java.util.Optional<S>getDeclaration()Get the declaration associated with the Symbol.booleanisSolved()Is the reference solved?static <S extends ResolvedDeclaration,S2 extends S>
SymbolReference<S>solved(S2 symbolDeclaration)Create a solve reference to the given symbol.java.lang.StringtoString()static <S extends ResolvedDeclaration>
SymbolReference<S>unsolved()Create a reference for an unsolved symbol.static <S extends ResolvedDeclaration,S2 extends S>
SymbolReference<S>unsolved(java.lang.Class<S2> clazz)Deprecated.Consider usingunsolved()instead.
-
-
-
Field Detail
-
correspondingDeclaration
private final S extends ResolvedDeclaration correspondingDeclaration
-
-
Method Detail
-
solved
public static <S extends ResolvedDeclaration,S2 extends S> SymbolReference<S> solved(S2 symbolDeclaration)
Create a solve reference to the given symbol.
-
unsolved
public static <S extends ResolvedDeclaration> SymbolReference<S> unsolved()
Create a reference for an unsolved symbol.- Type Parameters:
S- The symbol reference type.- Returns:
- The created unsolved symbol reference.
-
unsolved
@Deprecated public static <S extends ResolvedDeclaration,S2 extends S> SymbolReference<S> unsolved(java.lang.Class<S2> clazz)
Deprecated.Consider usingunsolved()instead.Create an unsolved reference specifying the type of the value expected.
-
adapt
public static <I extends ResolvedDeclaration,O extends ResolvedDeclaration> SymbolReference<O> adapt(SymbolReference<I> ref, java.lang.Class<O> clazz)
Adapt aSymbolReferenceinto anotherSymbolReference.- Type Parameters:
I- The Symbol Reference before adapting.O- The Symbol Reference after adapting.- Parameters:
ref- The reference to be adapted.clazz- The final type to be used.- Returns:
- The adapted symbol reference.
-
getDeclaration
public java.util.Optional<S> getDeclaration()
Get the declaration associated with the Symbol.- Returns:
- an
Optionalwith a present value if the symbol is solved, otherwise an emptyOptional.
-
getCorrespondingDeclaration
public S getCorrespondingDeclaration()
The corresponding declaration. If not solve this throws UnsupportedOperationException.
-
isSolved
public boolean isSolved()
Is the reference solved?
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-