Example usage for com.google.common.collect ImmutableList toString

List of usage examples for com.google.common.collect ImmutableList toString

Introduction

In this page you can find the example usage for com.google.common.collect ImmutableList toString.

Prototype

public String toString() 

Source Link

Document

Returns a string representation of the object.

Usage

From source file:com.facebook.buck.jvm.java.JavacToJarStepFactory.java

@Override
public void createCompileToJarStep(BuildContext context, ImmutableSortedSet<Path> sourceFilePaths,
        BuildTarget invokingRule, SourcePathResolver resolver, SourcePathRuleFinder ruleFinder,
        ProjectFilesystem filesystem, ImmutableSortedSet<Path> declaredClasspathEntries, Path outputDirectory,
        Optional<Path> workingDirectory, Path pathToSrcsList, Optional<SuggestBuildRules> suggestBuildRules,
        ImmutableList<String> postprocessClassesCommands, ImmutableSortedSet<Path> entriesToJar,
        Optional<String> mainClass, Optional<Path> manifestFile, Path outputJar,
        ClassUsageFileWriter usedClassesFileWriter,
        /* output params */
        ImmutableList.Builder<Step> steps, BuildableContext buildableContext,
        ImmutableSet<Pattern> classesToRemoveFromJar) {

    String spoolMode = javacOptions.getSpoolMode().name();
    // In order to use direct spooling to the Jar:
    // (1) It must be enabled through a .buckconfig.
    // (2) The target must have 0 postprocessing steps.
    // (3) Tha compile API must be JSR 199.
    boolean isSpoolingToJarEnabled = postprocessClassesCommands.isEmpty()
            && javacOptions.getSpoolMode() == AbstractJavacOptions.SpoolMode.DIRECT_TO_JAR
            && javacOptions.getJavac() instanceof Jsr199Javac;

    LOG.info("Target: %s SpoolMode: %s Expected SpoolMode: %s Postprocessing steps: %s",
            invokingRule.getBaseName(),//  w w w. ja  va 2s  .  co m
            (isSpoolingToJarEnabled) ? (SpoolMode.DIRECT_TO_JAR) : (SpoolMode.INTERMEDIATE_TO_DISK), spoolMode,
            postprocessClassesCommands.toString());

    if (isSpoolingToJarEnabled) {
        final JavacOptions buildTimeOptions = amender.amend(javacOptions, context);
        // Javac requires that the root directory for generated sources already exists.
        addAnnotationGenFolderStep(buildTimeOptions, filesystem, steps, buildableContext);

        steps.add(new JavacDirectToJarStep(sourceFilePaths, invokingRule, resolver, ruleFinder, filesystem,
                declaredClasspathEntries, buildTimeOptions, outputDirectory, workingDirectory, pathToSrcsList,
                suggestBuildRules, entriesToJar, mainClass, manifestFile, outputJar, usedClassesFileWriter));
    } else {
        super.createCompileToJarStep(context, sourceFilePaths, invokingRule, resolver, ruleFinder, filesystem,
                declaredClasspathEntries, outputDirectory, workingDirectory, pathToSrcsList, suggestBuildRules,
                postprocessClassesCommands, entriesToJar, mainClass, manifestFile, outputJar,
                usedClassesFileWriter, steps, buildableContext, javacOptions.getClassesToRemoveFromJar());
    }
}

From source file:com.facebook.buck.cli.BuckConfig.java

public ArtifactCache createArtifactCache(Optional<String> currentWifiSsid, BuckEventBus buckEventBus) {
    ImmutableList<String> modes = getArtifactCacheModes();
    if (modes.isEmpty()) {
        return new NoopArtifactCache();
    }/*from  w ww.  ja v  a  2s.  com*/
    ImmutableList.Builder<ArtifactCache> builder = ImmutableList.builder();
    try {
        for (String mode : modes) {
            switch (ArtifactCacheNames.valueOf(mode)) {
            case dir:
                ArtifactCache dirArtifactCache = createDirArtifactCache();
                buckEventBus.register(dirArtifactCache);
                builder.add(dirArtifactCache);
                break;
            case cassandra:
                ArtifactCache cassandraArtifactCache = createCassandraArtifactCache(currentWifiSsid,
                        buckEventBus);
                if (cassandraArtifactCache != null) {
                    builder.add(cassandraArtifactCache);
                }
                break;
            }
        }
    } catch (IllegalArgumentException e) {
        throw new HumanReadableException("Unusable cache.mode: '%s'", modes.toString());
    }
    ImmutableList<ArtifactCache> artifactCaches = builder.build();
    if (artifactCaches.size() == 1) {
        // Don't bother wrapping a single artifact cache in MultiArtifactCache.
        return artifactCaches.get(0);
    } else {
        return new MultiArtifactCache(artifactCaches);
    }
}

From source file:org.apache.atlas.hive.hook.HiveHookIT.java

private void runBucketSortQuery(String tableName, final int numBuckets, final ImmutableList<String> bucketCols,
        final ImmutableList<String> sortCols) throws Exception {
    final String fmtQuery = "alter table %s CLUSTERED BY (%s) SORTED BY (%s) INTO %s BUCKETS";
    String query = String.format(fmtQuery, tableName, stripListBrackets(bucketCols.toString()),
            stripListBrackets(sortCols.toString()), numBuckets);
    runCommand(query);//from  ww  w  .  j a  v a2  s  .co  m
    assertTableIsRegistered(DEFAULT_DB, tableName, new AssertPredicate() {
        @Override
        public void assertOnEntity(Referenceable entity) throws Exception {
            verifyBucketSortingProperties(entity, numBuckets, bucketCols, sortCols);
        }
    });
}