/** * Scopes down a model based on a specified endpoint name. */ public static void scopeModel(final Model model, @Nullable String endpoint) { model.establishStage(Merged.KEY); endpoint = Strings.isNullOrEmpty(endpoint) ? model.getServiceConfig().getName() : endpoint; if (endpoint == null) { // If the endpoint is still null, that means the service config has no name, which means it // is a test config, and we should do nothing. return; } validateEndpoint(model, endpoint); model.putAttribute(ENDPOINT_FILTER_KEY, endpoint); model.setScoper(model.getScoper().restrict(new Predicate<ProtoElement>() { @Override public boolean apply(ProtoElement element) { return inEndpoint(model, element); } }, "")); }
/** * Scopes down a model based on a specified endpoint name. */ public static void scopeModel(final Model model, @Nullable String endpoint) { model.establishStage(Merged.KEY); endpoint = Strings.isNullOrEmpty(endpoint) ? model.getServiceConfig().getName() : endpoint; if (endpoint == null) { // If the endpoint is still null, that means the service config has no name, which means it // is a test config, and we should do nothing. return; } validateEndpoint(model, endpoint); model.putAttribute(ENDPOINT_FILTER_KEY, endpoint); model.setScoper(model.getScoper().restrict(new Predicate<ProtoElement>() { @Override public boolean apply(ProtoElement element) { return inEndpoint(model, element); } }, "")); }