Example usage for com.google.common.collect ImmutableSet contains

List of usage examples for com.google.common.collect ImmutableSet contains

Introduction

In this page you can find the example usage for com.google.common.collect ImmutableSet contains.

Prototype

boolean contains(Object o);

Source Link

Document

Returns true if this set contains the specified element.

Usage

From source file:com.facebook.buck.model.MacroFinder.java

public ImmutableList<MacroMatchResult> findAll(ImmutableSet<String> macros, String blob) throws MacroException {

    ImmutableList.Builder<MacroMatchResult> results = ImmutableList.builder();
    MacroFinderAutomaton matcher = new MacroFinderAutomaton(blob);
    while (matcher.hasNext()) {
        MacroMatchResult matchResult = matcher.next();
        if (matchResult.isEscaped()) {
            continue;
        }// w  ww  .j  av  a 2 s .  c  o  m
        if (!macros.contains(matchResult.getMacroType())) {
            throw new MacroException(String.format("no such macro \"%s\"", matchResult.getMacroType()));
        }
        results.add(matchResult);
    }

    return results.build();
}

From source file:com.commercehub.dropwizard.BuildInfoServlet.java

@Override
public void init(ServletConfig config) {
    objectWriter = new ObjectMapper().writer();

    cacheControl = new CacheControl();
    cacheControl.setMustRevalidate(true);
    cacheControl.setNoCache(true);//w ww  .j  a  v a 2s  .c om
    cacheControl.setNoStore(true);

    // cache build information
    manifestAttributes = new Properties();
    ImmutableSet<String> attributeBlacklist = getAttributeBlacklist(config);
    try {
        Enumeration<URL> resources = getClass().getClassLoader().getResources(JarFile.MANIFEST_NAME);
        if (resources != null) {
            while (resources.hasMoreElements()) {
                Manifest manifest = new Manifest(resources.nextElement().openStream());
                Attributes attributes = manifest.getMainAttributes();
                for (Object key : attributes.keySet()) {
                    Attributes.Name attrName = (Attributes.Name) key;
                    if (!attributeBlacklist.contains(attrName.toString())) {
                        manifestAttributes.setProperty(attrName.toString(), attributes.getValue(attrName));
                    }
                }
            }
        }
    } catch (IOException e) {
        log.warn("Unable to retrieve build info", e);
    }
}

From source file:cryptoexplorer.Services.java

@GET
@Path("/list")
public String servicesList() {

    ImmutableSet<String> hasDetail = ImmutableSet.of("KeyStore", "SecureRandom");

    TreeSet<Map<String, String>> elements = newMapOrderedBy("name");

    for (Provider provider : getProviders()) {
        for (Service service : provider.getServices()) {
            String type = service.getType();
            elements.add(ImmutableMap.of("name", type, "description",
                    type.replaceAll(format("%s|%s|%s", "(?<=[A-Z])(?=[A-Z][a-z])", "(?<=[^A-Z])(?=[A-Z])",
                            "(?<=[A-Za-z])(?=[^A-Za-z])"), " "),
                    "hasDetail", hasDetail.contains(type) ? type : "false"));
        }//from www .ja v a 2s .c  o m
    }

    return new Gson().toJson(elements);
}

From source file:com.facebook.buck.command.config.AbstractConfigIgnoredByDaemon.java

@Value.Lazy
public ImmutableMap<String, ImmutableMap<String, String>> getRawConfigForParser() {
    ImmutableMap<String, ImmutableSet<String>> ignoredFields = getIgnoreFieldsForDaemonRestart();
    ImmutableMap<String, ImmutableMap<String, String>> rawSections = getDelegate().getConfig()
            .getSectionToEntries();/*from   w  w  w .ja v a  2 s. co m*/

    // If the raw config doesn't have sections which have ignored fields, then just return it as-is.
    ImmutableSet<String> sectionsWithIgnoredFields = ignoredFields.keySet();
    if (Sets.intersection(rawSections.keySet(), sectionsWithIgnoredFields).isEmpty()) {
        return rawSections;
    }

    // Otherwise, iterate through the config to do finer-grain filtering.
    ImmutableMap.Builder<String, ImmutableMap<String, String>> filtered = ImmutableMap.builder();
    for (Map.Entry<String, ImmutableMap<String, String>> sectionEnt : rawSections.entrySet()) {
        String sectionName = sectionEnt.getKey();

        // If this section doesn't have a corresponding ignored section, then just add it as-is.
        if (!sectionsWithIgnoredFields.contains(sectionName)) {
            filtered.put(sectionEnt);
            continue;
        }

        // If none of this section's entries are ignored, then add it as-is.
        ImmutableMap<String, String> fields = sectionEnt.getValue();
        ImmutableSet<String> ignoredFieldNames = ignoredFields.getOrDefault(sectionName, ImmutableSet.of());
        if (Sets.intersection(fields.keySet(), ignoredFieldNames).isEmpty()) {
            filtered.put(sectionEnt);
            continue;
        }

        // Otherwise, filter out the ignored fields.
        ImmutableMap<String, String> remainingKeys = ImmutableMap
                .copyOf(Maps.filterKeys(fields, Predicates.not(ignoredFieldNames::contains)));
        filtered.put(sectionName, remainingKeys);
    }

    return MoreMaps.filterValues(filtered.build(), Predicates.not(Map::isEmpty));
}

From source file:io.divolte.server.Server.java

Server(final ValidatedConfiguration vc, final IncomingRequestListener listener) {
    host = vc.configuration().global.server.host;
    port = vc.configuration().global.server.port;

    // First thing we need to do is load all the schemas: the sinks need these, but they come from the
    // mappings.//from  w  w  w .java  2s . co m
    final SchemaRegistry schemaRegistry = new SchemaRegistry(vc);

    // Build a set of referenced sinks. These are the only ones we need to instantiate.
    final ImmutableSet<String> referencedSinkNames = vc.configuration().mappings.values().stream()
            .flatMap(mc -> mc.sinks.stream()).collect(ImmutableSet.toImmutableSet());

    // Instantiate the active sinks:
    //  - As a practical matter, unreferenced sinks have no associated schema, which means they
    //    can't be initialized.
    //  - This is also where we check whether HDFS and Kafka are globally enabled/disabled.
    logger.debug("Initializing active sinks...");
    sinks = vc.configuration().sinks.entrySet().stream()
            .filter(sink -> referencedSinkNames.contains(sink.getKey()))
            .filter(sink -> vc.configuration().global.hdfs.enabled
                    || !(sink.getValue() instanceof HdfsSinkConfiguration))
            .filter(sink -> vc.configuration().global.gcs.enabled
                    || !(sink.getValue() instanceof GoogleCloudStorageSinkConfiguration))
            .filter(sink -> vc.configuration().global.kafka.enabled
                    || !(sink.getValue() instanceof KafkaSinkConfiguration))
            .collect(ImmutableMap.toImmutableMap(Map.Entry::getKey,
                    sink -> sink.getValue().getFactory().create(vc, sink.getKey(), schemaRegistry)));
    logger.info("Initialized sinks: {}", sinks.keySet());

    logger.debug("Initializing mappings...");
    incomingRequestProcessingPool = new IncomingRequestProcessingPool(vc, schemaRegistry, sinks, listener);

    logger.debug("Initializing sources...");
    // Now instantiate all the sources. We do this in parallel because instantiation can be quite slow.
    final ImmutableMap<String, HttpSource> sources = vc.configuration().sources.entrySet().parallelStream()
            .collect(ImmutableMap.toImmutableMap(Map.Entry::getKey, source -> source.getValue().createSource(vc,
                    source.getKey(), incomingRequestProcessingPool)));

    logger.debug("Attaching sources: {}", sources.keySet());
    // Once all created we can attach them to the server. This has to be done sequentially.
    PathHandler pathHandler = new PathHandler();
    for (final HttpSource source : sources.values()) {
        pathHandler = source.attachToPathHandler(pathHandler);
    }
    logger.info("Initialized sources: {}", sources.keySet());

    pathHandler.addExactPath("/ping", PingHandler::handlePingRequest);
    if (vc.configuration().global.server.serveStaticResources) {
        // Catch-all handler; must be last if present.
        // XXX: Our static resources assume the default 'browser' endpoint.
        pathHandler.addPrefixPath("/", createStaticResourceHandler());
    }
    final SetHeaderHandler headerHandler = new SetHeaderHandler(pathHandler, Headers.SERVER_STRING, "divolte");
    final HttpHandler canonicalPathHandler = new CanonicalPathHandler(headerHandler);
    final GracefulShutdownHandler rootHandler = new GracefulShutdownHandler(
            vc.configuration().global.server.useXForwardedFor
                    ? new ProxyAdjacentPeerAddressHandler(canonicalPathHandler)
                    : canonicalPathHandler);

    shutdownHandler = rootHandler;
    undertow = Undertow.builder().addHttpListener(port, host.orElse(null))
            .setHandler(vc.configuration().global.server.debugRequests ? new RequestDumpingHandler(rootHandler)
                    : rootHandler)
            .build();
}

From source file:com.facebook.buck.android.AndroidInstrumentationApk.java

@Override
public ImmutableSortedSet<BuildRule> getEnhancedDeps(BuildRuleResolver ruleResolver) {
    // Create the AndroidBinaryGraphEnhancer for this rule.
    final ImmutableSortedSet<BuildRule> originalDepsAndApk = ImmutableSortedSet.<BuildRule>naturalOrder()
            .addAll(originalDeps).add(apkUnderTestAsRule).build();
    rulesToExcludeFromDex = FluentIterable
            .from(ImmutableSet.<JavaLibrary>builder().addAll(apkUnderTest.getRulesToExcludeFromDex())
                    .addAll(Classpaths.getClasspathEntries(apkUnderTest.getClasspathDeps()).keySet()).build())
            .toSortedSet(HasBuildTarget.BUILD_TARGET_COMPARATOR);
    AndroidTransitiveDependencyGraph androidTransitiveDependencyGraph = new AndroidTransitiveDependencyGraph(
            originalDepsAndApk);/*from   w  ww  . ja  v  a  2  s  .co  m*/

    // The AndroidResourceDepsFinder is the primary data that differentiates how
    // AndroidInstrumentationApk and AndroidBinaryRule are built.
    androidResourceDepsFinder = new AndroidResourceDepsFinder(androidTransitiveDependencyGraph,
            rulesToExcludeFromDex) {
        @Override
        protected ImmutableList<HasAndroidResourceDeps> findMyAndroidResourceDeps() {
            // Filter out the AndroidResourceRules that are needed by this APK but not the APK under
            // test.
            ImmutableSet<HasAndroidResourceDeps> originalResources = ImmutableSet
                    .copyOf(UberRDotJavaUtil.getAndroidResourceDeps(apkUnderTestAsRule));
            ImmutableList<HasAndroidResourceDeps> instrumentationResources = UberRDotJavaUtil
                    .getAndroidResourceDeps(originalDepsAndApk);

            // Include all of the instrumentation resources first, in their original order.
            ImmutableList.Builder<HasAndroidResourceDeps> allResources = ImmutableList.builder();
            for (HasAndroidResourceDeps resource : instrumentationResources) {
                if (!originalResources.contains(resource)) {
                    allResources.add(resource);
                }
            }
            return allResources.build();
        }
    };

    Path primaryDexPath = AndroidBinary.getPrimaryDexPath(getBuildTarget());
    AndroidBinaryGraphEnhancer graphEnhancer = new AndroidBinaryGraphEnhancer(params, ruleResolver,
            ResourceCompressionMode.DISABLED, ResourceFilter.EMPTY_FILTER, androidResourceDepsFinder, manifest,
            PackageType.INSTRUMENTED, apkUnderTest.getCpuFilters(), /* shouldBuildStringSourceMap */ false,
            /* shouldPreDex */ false, primaryDexPath, DexSplitMode.NO_SPLIT,
            /* rulesToExcludeFromDex */ ImmutableSortedSet.<BuildTarget>of(), JavacOptions.DEFAULTS,
            /* exopackage */ false, apkUnderTest.getKeystore());

    AndroidBinaryGraphEnhancer.EnhancementResult result = graphEnhancer.createAdditionalBuildables();

    setGraphEnhancementResult(result);

    return result.getFinalDeps();
}

From source file:com.google.devtools.build.lib.runtime.ExperimentalEventHandler.java

/**
 * Return true, if the test summary provides information that is both
 * worth being shown in the scroll-back buffer and new with respect to
 * the alreay shown failure messages./* w  w  w . j a  v a 2  s  .co  m*/
 */
private boolean testSummaryProvidesNewInformation(TestSummary summary) {
    ImmutableSet<BlazeTestStatus> statusToIgnore = ImmutableSet.of(BlazeTestStatus.PASSED,
            BlazeTestStatus.FAILED_TO_BUILD, BlazeTestStatus.BLAZE_HALTED_BEFORE_TESTING,
            BlazeTestStatus.NO_STATUS);

    if (statusToIgnore.contains(summary.getStatus())) {
        return false;
    }
    if (summary.getStatus() == BlazeTestStatus.FAILED && summary.getFailedLogs().size() == 1) {
        return false;
    }
    return true;
}

From source file:com.google.api.codegen.MethodConfig.java

/**
 * Creates an instance of MethodConfig based on MethodConfigProto, linking it up with the provided
 * method. On errors, null will be returned, and diagnostics are reported to the diag collector.
 *///from  w  w w .  ja v  a 2s.c om
@Nullable
public static MethodConfig createMethodConfig(DiagCollector diagCollector,
        final MethodConfigProto methodConfigProto, Method method, ImmutableSet<String> retryCodesConfigNames,
        ImmutableSet<String> retryParamsConfigNames) {

    boolean error = false;

    PageStreamingConfig pageStreaming;
    if (PageStreamingConfigProto.getDefaultInstance().equals(methodConfigProto.getPageStreaming())) {
        pageStreaming = null;
    } else {
        pageStreaming = PageStreamingConfig.createPageStreaming(diagCollector,
                methodConfigProto.getPageStreaming(), method);
        if (pageStreaming == null) {
            error = true;
        }
    }

    FlatteningConfig flattening;
    if (FlatteningConfigProto.getDefaultInstance().equals(methodConfigProto.getFlattening())) {
        flattening = null;
    } else {
        flattening = FlatteningConfig.createFlattening(diagCollector, methodConfigProto.getFlattening(),
                method);
        if (flattening == null) {
            error = true;
        }
    }

    BundlingConfig bundling;
    if (BundlingConfigProto.getDefaultInstance().equals(methodConfigProto.getBundling())) {
        bundling = null;
    } else {
        bundling = BundlingConfig.createBundling(diagCollector, methodConfigProto.getBundling(), method);
        if (bundling == null) {
            error = true;
        }
    }

    String retryCodesName = methodConfigProto.getRetryCodesName();
    if (!retryCodesName.isEmpty() && !retryCodesConfigNames.contains(retryCodesName)) {
        diagCollector.addDiag(Diag.error(SimpleLocation.TOPLEVEL,
                "Retry codes config used but not defined: '%s' (in method %s)", retryCodesName,
                method.getFullName()));
        error = true;
    }

    String retryParamsName = methodConfigProto.getRetryParamsName();
    if (!retryParamsConfigNames.isEmpty() && !retryParamsConfigNames.contains(retryParamsName)) {
        diagCollector.addDiag(Diag.error(SimpleLocation.TOPLEVEL,
                "Retry parameters config used but not defined: %s (in method %s)", retryParamsName,
                method.getFullName()));
        error = true;
    }

    Duration timeout = Duration.millis(methodConfigProto.getTimeoutMillis());
    if (timeout.getMillis() <= 0) {
        diagCollector.addDiag(Diag.error(SimpleLocation.TOPLEVEL,
                "Default timeout not found or has invalid value (in method %s)", method.getFullName()));
        error = true;
    }

    boolean hasRequestObjectMethod = methodConfigProto.getRequestObjectMethod();

    List<String> requiredFieldNames = methodConfigProto.getRequiredFieldsList();
    ImmutableSet.Builder<Field> builder = ImmutableSet.builder();
    for (String fieldName : requiredFieldNames) {
        Field requiredField = method.getInputMessage().lookupField(fieldName);
        if (requiredField != null) {
            builder.add(requiredField);
        } else {
            Diag.error(SimpleLocation.TOPLEVEL, "Required field '%s' not found (in method %s)", fieldName,
                    method.getFullName());
            error = true;
        }
    }
    Set<Field> requiredFields = builder.build();

    Iterable<Field> optionalFields = Iterables.filter(method.getInputType().getMessageType().getFields(),
            new Predicate<Field>() {
                @Override
                public boolean apply(Field input) {
                    return !(methodConfigProto.getRequiredFieldsList().contains(input.getSimpleName()));
                }
            });

    ImmutableMap<String, String> fieldNamePatterns = ImmutableMap
            .copyOf(methodConfigProto.getFieldNamePatterns());

    List<String> sampleCodeInitFields = new ArrayList<>();
    sampleCodeInitFields.addAll(methodConfigProto.getRequiredFieldsList());
    sampleCodeInitFields.addAll(methodConfigProto.getSampleCodeInitFieldsList());

    if (error) {
        return null;
    } else {
        return new MethodConfig(pageStreaming, flattening, retryCodesName, retryParamsName, timeout, bundling,
                hasRequestObjectMethod, requiredFields, optionalFields, fieldNamePatterns,
                sampleCodeInitFields);
    }
}

From source file:com.google.javascript.jscomp.newtypes.JSType.java

/**
 * Both {@code meet} and {@code specialize} do the same computation for enums.
 * They don't just compute the set of enums; they may modify mask and objs.
 * So, both methods finish off by calling this one.
 *///w w  w.j a v  a2 s  .c om
private static JSType meetEnums(int newMask, int unionMask, ImmutableSet<ObjectType> newObjs, String newTypevar,
        ImmutableSet<ObjectType> objs1, ImmutableSet<ObjectType> objs2, ImmutableSet<EnumType> enums1,
        ImmutableSet<EnumType> enums2) {
    if (Objects.equals(enums1, enums2)) {
        return makeType(newMask, newObjs, newTypevar, enums1);
    }
    ImmutableSet.Builder<EnumType> enumBuilder = ImmutableSet.builder();
    ImmutableSet<EnumType> allEnums = EnumType.union(enums1, enums2);
    for (EnumType e : allEnums) {
        // An enum in the intersection will always be in the result
        if (enums1 != null && enums1.contains(e) && enums2 != null && enums2.contains(e)) {
            enumBuilder.add(e);
            continue;
        }
        // An enum {?} in the union will always be in the result
        JSType enumeratedType = e.getEnumeratedType();
        if (enumeratedType.isUnknown()) {
            enumBuilder.add(e);
            continue;
        }
        // An enum {TypeA} meets with any supertype of TypeA. When this happens,
        // we put the enum in the result and remove the supertype.
        // The following would be much more complex if we allowed the type of
        // an enum to be a union.
        if (enumeratedType.getMask() != NON_SCALAR_MASK) {
            if ((enumeratedType.getMask() & unionMask) != 0) {
                enumBuilder.add(e);
                newMask &= ~enumeratedType.getMask();
            }
        } else if (!objs1.isEmpty() || !objs2.isEmpty()) {
            Set<ObjectType> objsToRemove = new LinkedHashSet<>();
            ObjectType enumObj = Iterables.getOnlyElement(enumeratedType.getObjs());
            for (ObjectType obj1 : objs1) {
                if (enumObj.isSubtypeOf(obj1)) {
                    enumBuilder.add(e);
                    objsToRemove.add(obj1);
                }
            }
            for (ObjectType obj2 : objs2) {
                if (enumObj.isSubtypeOf(obj2)) {
                    enumBuilder.add(e);
                    objsToRemove.add(obj2);
                }
            }
            if (!objsToRemove.isEmpty()) {
                newObjs = Sets.difference(newObjs, objsToRemove).immutableCopy();
            }
        }
    }
    return makeType(newMask, newObjs, newTypevar, enumBuilder.build());
}

From source file:com.google.api.codegen.config.DiscoGapicMethodConfig.java

/**
 * Creates an instance of DiscoGapicMethodConfig based on MethodConfigProto, linking it up with
 * the provided method. On errors, null will be returned, and diagnostics are reported to the diag
 * collector.//from   w w  w  .j  a  v  a2 s  .  c  o m
 */
@Nullable
static DiscoGapicMethodConfig createDiscoGapicMethodConfig(DiscoApiModel apiModel, TargetLanguage language,
        MethodConfigProto methodConfigProto, Method method, ResourceNameMessageConfigs messageConfigs,
        ImmutableMap<String, ResourceNameConfig> resourceNameConfigs,
        ImmutableSet<String> retryCodesConfigNames, ImmutableSet<String> retryParamsConfigNames) {

    boolean error = false;
    DiscoveryMethodModel methodModel = new DiscoveryMethodModel(method, apiModel);
    DiagCollector diagCollector = apiModel.getDiagCollector();

    PageStreamingConfig pageStreaming = null;
    if (!PageStreamingConfigProto.getDefaultInstance().equals(methodConfigProto.getPageStreaming())) {
        pageStreaming = PageStreamingConfig.createPageStreaming(diagCollector, messageConfigs,
                resourceNameConfigs, methodConfigProto, methodModel);
        if (pageStreaming == null) {
            error = true;
        }
    }

    ImmutableList<FlatteningConfig> flattening = null;
    if (!FlatteningConfigProto.getDefaultInstance().equals(methodConfigProto.getFlattening())) {
        flattening = createFlattening(diagCollector, messageConfigs, resourceNameConfigs, methodConfigProto,
                methodModel);
        if (flattening == null) {
            error = true;
        }
    }

    BatchingConfig batching = null;
    if (!BatchingConfigProto.getDefaultInstance().equals(methodConfigProto.getBatching())) {
        batching = BatchingConfig.createBatching(diagCollector, methodConfigProto.getBatching(), methodModel);
        if (batching == null) {
            error = true;
        }
    }

    String retryCodesName = methodConfigProto.getRetryCodesName();
    if (!retryCodesName.isEmpty() && !retryCodesConfigNames.contains(retryCodesName)) {
        diagCollector.addDiag(Diag.error(SimpleLocation.TOPLEVEL,
                "Retry codes config used but not defined: '%s' (in method %s)", retryCodesName,
                methodModel.getFullName()));
        error = true;
    }

    String retryParamsName = methodConfigProto.getRetryParamsName();
    if (!retryParamsConfigNames.isEmpty() && !retryParamsConfigNames.contains(retryParamsName)) {
        diagCollector.addDiag(Diag.error(SimpleLocation.TOPLEVEL,
                "Retry parameters config used but not defined: %s (in method %s)", retryParamsName,
                methodModel.getFullName()));
        error = true;
    }

    Duration timeout = Duration.ofMillis(methodConfigProto.getTimeoutMillis());
    if (timeout.toMillis() <= 0) {
        diagCollector.addDiag(Diag.error(SimpleLocation.TOPLEVEL,
                "Default timeout not found or has invalid value (in method %s)", methodModel.getFullName()));
        error = true;
    }

    boolean hasRequestObjectMethod = methodConfigProto.getRequestObjectMethod();

    ImmutableMap<String, String> fieldNamePatterns = ImmutableMap
            .copyOf(methodConfigProto.getFieldNamePatterns());

    ResourceNameTreatment defaultResourceNameTreatment = methodConfigProto.getResourceNameTreatment();
    if (defaultResourceNameTreatment == null
            || defaultResourceNameTreatment.equals(ResourceNameTreatment.UNSET_TREATMENT)) {
        defaultResourceNameTreatment = ResourceNameTreatment.NONE;
    }

    List<String> requiredFieldsList = Lists.newArrayList(methodConfigProto.getRequiredFieldsList());
    if (methodModel.hasExtraFieldMask()) {
        requiredFieldsList.add(DiscoveryMethodTransformer.FIELDMASK_STRING);
    }
    Iterable<FieldConfig> requiredFieldConfigs = createFieldNameConfigs(diagCollector, messageConfigs,
            defaultResourceNameTreatment, fieldNamePatterns, resourceNameConfigs,
            getRequiredFields(diagCollector, methodModel, requiredFieldsList));

    Iterable<FieldConfig> optionalFieldConfigs = createFieldNameConfigs(diagCollector, messageConfigs,
            defaultResourceNameTreatment, fieldNamePatterns, resourceNameConfigs,
            getOptionalFields(methodModel, requiredFieldsList));

    List<String> sampleCodeInitFields = new ArrayList<>();
    sampleCodeInitFields.addAll(methodConfigProto.getSampleCodeInitFieldsList());
    SampleSpec sampleSpec = new SampleSpec(methodConfigProto);

    VisibilityConfig visibility = VisibilityConfig.PUBLIC;
    ReleaseLevel releaseLevel = ReleaseLevel.ALPHA;
    for (SurfaceTreatmentProto treatment : methodConfigProto.getSurfaceTreatmentsList()) {
        if (!treatment.getIncludeLanguagesList().contains(language.toString().toLowerCase())) {
            continue;
        }
        if (treatment.getVisibility() != VisibilityProto.UNSET_VISIBILITY) {
            visibility = VisibilityConfig.fromProto(treatment.getVisibility());
        }
        if (treatment.getReleaseLevel() != ReleaseLevel.UNSET_RELEASE_LEVEL) {
            releaseLevel = treatment.getReleaseLevel();
        }
    }

    LongRunningConfig longRunningConfig = null;

    if (error) {
        return null;
    } else {
        return new AutoValue_DiscoGapicMethodConfig(methodModel, pageStreaming, flattening, retryCodesName,
                retryParamsName, timeout, requiredFieldConfigs, optionalFieldConfigs,
                defaultResourceNameTreatment, batching, hasRequestObjectMethod, fieldNamePatterns,
                sampleCodeInitFields, sampleSpec, visibility, releaseLevel, longRunningConfig);
    }
}