Interface NameResolver<S>
-
- Type Parameters:
S
- Type of symbols
- All Known Subinterfaces:
NameResolver.SingleNameResolver<S>
public interface NameResolver<S>
Name resolvers are strategies backingShadowChain
s. They have no information about outer context, instead the structure of the shadow group chain handles that.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
NameResolver.SingleNameResolver<S>
A base class for resolvers that know at most one symbol for any given name.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description static <T> NameResolver<T>
composite(List<? extends NameResolver<? extends T>> resolvers)
Returns a resolver that concatenates the results of every resolver in the given list.default boolean
isDefinitelyEmpty()
Returns true if this resolver knows it cannot resolve anything.default @NonNull OptionalBool
knows(String simpleName)
Returns whether this resolver knows if it has a declaration for the given name.default @Nullable S
resolveFirst(String simpleName)
Resolves the first symbol that would be part of the list yielded byresolveHere(String)
for the given name.@NonNull List<S>
resolveHere(String simpleName)
Returns all symbols known by this resolver that have the given simple name.String
toString()
Please implement toString to ease debugging.
-
-
-
Method Detail
-
resolveHere
@NonNull List<S> resolveHere(String simpleName)
Returns all symbols known by this resolver that have the given simple name. Depending on language semantics, finding several symbols may mean there is ambiguity. If no such symbol is known, returns an empty list.- Parameters:
simpleName
- Simple name
-
resolveFirst
default @Nullable S resolveFirst(String simpleName)
Resolves the first symbol that would be part of the list yielded byresolveHere(String)
for the given name. If the list would be empty (no such symbol is known), returns null.
-
knows
default @NonNull OptionalBool knows(String simpleName)
Returns whether this resolver knows if it has a declaration for the given name. If the result is NO, then resolveFirst MUST be null, if the result is YES, then resolveFirst MUST be non-null. Otherwise we don't know.
-
isDefinitelyEmpty
default boolean isDefinitelyEmpty()
Returns true if this resolver knows it cannot resolve anything.
-
toString
String toString()
Please implement toString to ease debugging.
-
composite
static <T> NameResolver<T> composite(List<? extends NameResolver<? extends T>> resolvers)
Returns a resolver that concatenates the results of every resolver in the given list.- Type Parameters:
T
- Type of symbol- Parameters:
resolvers
- Resolvers
-
-