public abstract class ScoperImpl extends java.lang.Object implements Scoper
inScope(ProtoElement) method of this class. The class computes the transitive closure
of reachable elements from a given set of roots and uses it to implement the Scoper
interface. During construction of a scoper, errors may be produced if scoping rules are
violated. See the documentation of API visibility for the rules.| Modifier and Type | Field and Description |
|---|---|
protected java.util.Map<ProtoElement,java.lang.String> |
reasonForUnreachable |
UNRESTRICTED| Modifier | Constructor and Description |
|---|---|
protected |
ScoperImpl(java.lang.Iterable<? extends ProtoElement> roots,
java.lang.String errorContext)
Constructs a scoper for the given roots.
|
| Modifier and Type | Method and Description |
|---|---|
static Scoper |
create(java.lang.Iterable<ProtoElement> roots)
Returns a scoper which restricts a model to the elements reachable via the given roots.
|
<E extends ProtoElement> |
filter(java.lang.Iterable<E> elems)
Filters the given iterable to the elements reachable with this scoper.
|
boolean |
hasUnreachableDescendants(ProtoElement elem)
Returns true if the given message or enum type has any hidden, non-reachable descendants, e.g.
|
abstract boolean |
inScope(ProtoElement elem)
Determines whether the given proto element is in scope.
|
boolean |
isReachable(ProtoElement elem)
Returns true if the element is reachable with this scoper.
|
Scoper |
restrict(Model model,
java.util.Set<java.lang.String> visibilityLabels)
Returns a scoper which restricts a model to the elements reachable with given visibility labels
applied.
|
Scoper |
restrict(com.google.common.base.Predicate<ProtoElement> predicate,
java.lang.String errorContext)
Returns a scoper which refines restrictions on this scoper using the predicate.
|
protected final java.util.Map<ProtoElement,java.lang.String> reasonForUnreachable
protected ScoperImpl(java.lang.Iterable<? extends ProtoElement> roots, java.lang.String errorContext)
inScope(ProtoElement) predicate. This may produced errors
in the case elements are not in scope which are required by in-scope ones, e.g.
request/response messages of methods are not in scope which are used by in-scope
methods.public static Scoper create(java.lang.Iterable<ProtoElement> roots)
public abstract boolean inScope(ProtoElement elem)
public boolean isReachable(ProtoElement elem)
ScoperisReachable in interface Scoperpublic boolean hasUnreachableDescendants(ProtoElement elem)
ScoperhasUnreachableDescendants in interface Scoperpublic <E extends ProtoElement> java.lang.Iterable<E> filter(java.lang.Iterable<E> elems)
Scoperpublic Scoper restrict(Model model, java.util.Set<java.lang.String> visibilityLabels)
Scoperpublic Scoper restrict(com.google.common.base.Predicate<ProtoElement> predicate, java.lang.String errorContext)
Scoper