@Override public Location getLocation() { return model.getLocation(); }
@Override public Location getLocation() { return model.getLocation(); }
/** Checks if any endpoint/alias occurs more than once in the service config. */ private void checkForDuplicates(List<Endpoint> endpoints) { Set<String> unique = Sets.newHashSet(); Set<String> dupes = Sets.newLinkedHashSet(); for (Endpoint endpoint : endpoints) { String name = endpoint.getName(); if (unique.contains(name)) { dupes.add(name); } else { unique.add(name); } for (String alias : endpoint.getAliasesList()) { if (unique.contains(alias)) { dupes.add(alias); } else { unique.add(alias); } } } if (dupes.size() > 0) { error( ResolvedLocation.create(getModel().getLocation()), "The following endpoints/aliases occur multiple times: %s.", dupes); } }
/** Checks if any endpoint/alias occurs more than once in the service config. */ private void checkForDuplicates(List<Endpoint> endpoints) { Set<String> unique = Sets.newHashSet(); Set<String> dupes = Sets.newLinkedHashSet(); for (Endpoint endpoint : endpoints) { String name = endpoint.getName(); if (unique.contains(name)) { dupes.add(name); } else { unique.add(name); } for (String alias : endpoint.getAliasesList()) { if (unique.contains(alias)) { dupes.add(alias); } else { unique.add(alias); } } } if (dupes.size() > 0) { error( ResolvedLocation.create(getModel().getLocation()), "The following endpoints/aliases occur multiple times: %s.", dupes); } }
/** Validates the DNS name(s) of an endpoint. */ private boolean validateDns(String dns, String errorPrefix) { if (Strings.isNullOrEmpty(dns)) { error( ResolvedLocation.create(getModel().getLocation()), "%s in service '%s' must not be empty.", errorPrefix, getModel().getServiceConfig().getName()); return false; } return true; }
/** Validates the DNS name(s) of an endpoint. */ private boolean validateDns(String dns, String errorPrefix) { if (Strings.isNullOrEmpty(dns)) { error( ResolvedLocation.create(getModel().getLocation()), "%s in service '%s' must not be empty.", errorPrefix, getModel().getServiceConfig().getName()); return false; } return true; }
@Override public void startMerging() { if (!Strings.isNullOrEmpty(environment)) { if (!SUPPORTED_ENVS.contains(environment)) { error( getModel().getLocation(), "Control environment '%s' is not one of the supported environments: %s", environment, SUPPORTED_ENVS); } } else { String message = LintRule.formatLintWarning( "Service %s does not have control environment configured.", NO_CONTROL_ENV, NAME, getModel().getServiceConfig().getName()); getDiagReporter().reportWarning(ResolvedLocation.create(getModel().getLocation()), message); } }
if (Strings.isNullOrEmpty(page.getName())) { error( getModel().getLocation(), "Found empty subpage name of '%s' page.", parentPageNameInError); } else if (names.contains(page.getName())) { error( getModel().getLocation(), "Found duplicate subpage name '%s' of '%s' page.", page.getName(), != null) { error( getModel().getLocation(), "Found conflict subpage name '%s' of '%s' page with ProtoElement.", page.getName(),
@Override public void startMerging() { if (!Strings.isNullOrEmpty(environment)) { if (!SUPPORTED_ENVS.contains(environment)) { error( getModel().getLocation(), "Control environment '%s' is not one of the supported environments: %s", environment, SUPPORTED_ENVS); } } else { String message = LintRule.formatLintWarning( "Service %s does not have control environment configured.", NO_CONTROL_ENV, NAME, getModel().getServiceConfig().getName()); getDiagReporter().reportWarning(ResolvedLocation.create(getModel().getLocation()), message); } }
if (Strings.isNullOrEmpty(page.getName())) { error( getModel().getLocation(), "Found empty subpage name of '%s' page.", parentPageNameInError); } else if (names.contains(page.getName())) { error( getModel().getLocation(), "Found duplicate subpage name '%s' of '%s' page.", page.getName(), != null) { error( getModel().getLocation(), "Found conflict subpage name '%s' of '%s' page with ProtoElement.", page.getName(),
private ConfigMerger createMerger(Model model, String fileName) { ConfigHelper helper = new ConfigHelper(model.getDiagReporter().getDiagCollector(), fileName); String packageName = GapicProductConfig.getPackageName(model); if (packageName == null) { helper.error(model.getLocation(), "Failed to determine package name."); return null; } CollectionMerger collectionMerger = new CollectionMerger(); RetryMerger retryMerger = new RetryMerger(); PageStreamingMerger pageStreamingMerger = new PageStreamingMerger(new ProtoPageStreamingTransformer(), helper); MethodMerger methodMerger = new MethodMerger(retryMerger, pageStreamingMerger, new ProtoMethodTransformer()); LanguageSettingsMerger languageSettingsMerger = new LanguageSettingsMerger(); InterfaceTransformer interfaceTranformer = new ProtoInterfaceTransformer(); InterfaceMerger interfaceMerger = new InterfaceMerger(collectionMerger, retryMerger, methodMerger, interfaceTranformer); return new ConfigMerger(languageSettingsMerger, interfaceMerger, packageName, helper); } }