Java Code Examples for com.google.common.collect.ImmutableList.Builder#addAll()
The following examples show how to use
com.google.common.collect.ImmutableList.Builder#addAll() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: OracleDialect.java From morf with Apache License 2.0 | 6 votes |
/** * @see org.alfasoftware.morf.jdbc.SqlDialect#addTableFromStatements(org.alfasoftware.morf.metadata.Table, org.alfasoftware.morf.sql.SelectStatement) */ @Override public Collection<String> addTableFromStatements(Table table, SelectStatement selectStatement) { Builder<String> result = ImmutableList.<String>builder(); result.add(new StringBuilder() .append(createTableStatement(table, true)) .append(" AS ") .append(convertStatementToSQL(selectStatement)) .toString() ); result.add("ALTER TABLE " + schemaNamePrefix() + table.getName() + " NOPARALLEL LOGGING"); if (!primaryKeysForTable(table).isEmpty()) { result.add("ALTER INDEX " + schemaNamePrefix() + primaryKeyConstraintName(table.getName()) + " NOPARALLEL LOGGING"); } result.addAll(buildRemainingStatementsAndComments(table)); return result.build(); }
Example 2
Source File: SearchMappingsServiceImpl.java From nexus-public with Eclipse Public License 1.0 | 6 votes |
private static Collection<SearchMapping> collectMappings(final Map<String, SearchMappings> searchMappings) { final Builder<SearchMapping> builder = ImmutableList.builder(); // put the default mappings in first final SearchMappings defaultMappings = searchMappings.get(DEFAULT); if (defaultMappings != null) { builder.addAll(defaultMappings.get()); } // add the rest of the mappings searchMappings.keySet().stream() .filter(key -> !DEFAULT.equals(key)) .sorted() .forEach(key -> builder.addAll(searchMappings.get(key).get())); return builder.build(); }
Example 3
Source File: PrebuiltPythonLibrary.java From buck with Apache License 2.0 | 6 votes |
@Override public ImmutableList<? extends Step> getBuildSteps( BuildContext context, BuildableContext buildableContext) { Builder<Step> builder = ImmutableList.builder(); buildableContext.recordArtifact(extractedOutput); builder.addAll( MakeCleanDirectoryStep.of( BuildCellRelativePath.fromCellRelativePath( context.getBuildCellRootPath(), getProjectFilesystem(), extractedOutput))); builder.add( new UnzipStep( getProjectFilesystem(), context.getSourcePathResolver().getAbsolutePath(binarySrc), extractedOutput, Optional.empty())); builder.add(new MovePythonWhlDataStep(getProjectFilesystem(), extractedOutput)); return builder.build(); }
Example 4
Source File: AbstractArmeriaBeanPostProcessor.java From armeria with Apache License 2.0 | 6 votes |
private LocalArmeriaPortsElement(Member member, @Nullable PropertyDescriptor pd) { super(member, pd); Server server = getServer(); if (server == null) { server = beanFactory.getBean(Server.class); serServer(server); } final Builder<Integer> ports = ImmutableList.builder(); if (portsCache.isEmpty()) { synchronized (portsCache) { if (portsCache.isEmpty()) { ports.addAll(server.activePorts().values().stream() .map(p -> p.localAddress().getPort()) .collect(toImmutableList())); portsCache.addAll(ports.build()); } else { ports.addAll(portsCache); } } } else { ports.addAll(portsCache); } this.ports = ports.build(); }
Example 5
Source File: ParallelProfileService.java From SquirrelID with GNU Lesser General Public License v3.0 | 6 votes |
@Override public ImmutableList<Profile> findAllByName(Iterable<String> names) throws IOException, InterruptedException { CompletionService<List<Profile>> completion = new ExecutorCompletionService<>(executorService); int count = 0; for (final List<String> partition : Iterables.partition(names, getEffectiveProfilesPerJob())) { count++; completion.submit(() -> resolver.findAllByName(partition)); } Builder<Profile> builder = ImmutableList.builder(); for (int i = 0; i < count; i++) { try { builder.addAll(completion.take().get()); } catch (ExecutionException e) { if (e.getCause() instanceof IOException) { throw (IOException) e.getCause(); } else { throw new RuntimeException("Error occurred during the operation", e); } } } return builder.build(); }
Example 6
Source File: QueryUtils.java From molgenis with GNU Lesser General Public License v3.0 | 6 votes |
/** * Same as {@link #getAttributePath(String, EntityType)} but adds an id attribute to the path is * the last element is a reference attribute. * * @param queryRuleField query rule field name, e.g. grandparent.parent.child * @param entityType entity type * @param expandLabelInsteadOfId expand with label attribute instead of id attribute * @return attribute path * @throws UnknownAttributeException if no attribute exists for a query rule field name part * @throws MolgenisQueryException if query rule field is an invalid attribute path */ public static List<Attribute> getAttributePathExpanded( String queryRuleField, EntityType entityType, boolean expandLabelInsteadOfId) { List<Attribute> attributePath = getAttributePath(queryRuleField, entityType); List<Attribute> expandedAttributePath; Attribute attribute = attributePath.get(attributePath.size() - 1); if (attribute.hasRefEntity()) { Attribute expandedAttribute; if (expandLabelInsteadOfId) { expandedAttribute = attribute.getRefEntity().getLabelAttribute(); } else { expandedAttribute = attribute.getRefEntity().getIdAttribute(); } @SuppressWarnings("UnstableApiUsage") Builder<Attribute> builder = ImmutableList.builderWithExpectedSize(attributePath.size() + 1); builder.addAll(attributePath); builder.add(expandedAttribute); expandedAttributePath = builder.build(); } else { expandedAttributePath = attributePath; } return expandedAttributePath; }
Example 7
Source File: ModernBuildRule.java From buck with Apache License 2.0 | 5 votes |
/** Gets the steps for preparing the output directories of the build rule. */ public static void getSetupStepsForBuildable( BuildContext context, ProjectFilesystem filesystem, Iterable<Path> outputs, Builder<Step> stepBuilder, OutputPathResolver outputPathResolver) { // TODO(cjhopman): This should probably actually be handled by the build engine. for (Path output : outputs) { // Don't delete paths that are invalid now; leave it to the Buildable to handle this. if (!isValidOutputPath(filesystem, output)) { continue; } // Don't bother deleting the root path or anything under it, we're about to delete it and // re-create it. if (!output.startsWith(outputPathResolver.getRootPath())) { stepBuilder.add( RmStep.of( BuildCellRelativePath.fromCellRelativePath( context.getBuildCellRootPath(), filesystem, output), true)); } } stepBuilder.addAll( MakeCleanDirectoryStep.of( BuildCellRelativePath.fromCellRelativePath( context.getBuildCellRootPath(), filesystem, outputPathResolver.getRootPath()))); stepBuilder.addAll( MakeCleanDirectoryStep.of( BuildCellRelativePath.fromCellRelativePath( context.getBuildCellRootPath(), filesystem, outputPathResolver.getTempPath()))); }
Example 8
Source File: ConfigBasedUnresolvedRustPlatform.java From buck with Apache License 2.0 | 5 votes |
@Override public Iterable<BuildTarget> getParseTimeDeps(TargetConfiguration targetConfiguration) { Builder<BuildTarget> deps = ImmutableList.<BuildTarget>builder() .addAll(unresolvedCxxPlatform.getParseTimeDeps(targetConfiguration)); deps.addAll(rustCompiler.getParseTimeDeps(targetConfiguration)); linkerOverride.ifPresent(l -> deps.addAll(l.getParseTimeDeps(targetConfiguration))); return deps.build(); }
Example 9
Source File: GoTestMain.java From buck with Apache License 2.0 | 5 votes |
@Override public ImmutableList<Step> getBuildSteps( BuildContext context, BuildableContext buildableContext) { buildableContext.recordArtifact(output); Builder<Step> steps = ImmutableList.<Step>builder() .add( MkdirStep.of( BuildCellRelativePath.fromCellRelativePath( context.getBuildCellRootPath(), getProjectFilesystem(), output.getParent()))); FilteredSourceFiles filteredSrcs = new FilteredSourceFiles( GoCompile.getSourceFiles(testSources, context), ImmutableList.of(), platform, ImmutableList.of(ListType.GoFiles, ListType.TestGoFiles, ListType.XTestGoFiles)); steps.addAll(filteredSrcs.getFilterSteps()); steps.add( new GoTestMainStep( getProjectFilesystem().getRootPath(), testMainGen.getEnvironment(context.getSourcePathResolver()), testMainGen.getCommandPrefix(context.getSourcePathResolver()), coverageMode, coverVariables, testPackage, filteredSrcs, output)); return steps.build(); }
Example 10
Source File: JavacToJarStepFactory.java From buck with Apache License 2.0 | 5 votes |
private static void addAnnotationGenFolderStep( BuildTarget invokingTarget, ProjectFilesystem filesystem, Builder<Step> steps, BuildableContext buildableContext, BuildContext buildContext) { Path annotationGenFolder = CompilerOutputPaths.getAnnotationPath(filesystem, invokingTarget).get(); steps.addAll( MakeCleanDirectoryStep.of( BuildCellRelativePath.fromCellRelativePath( buildContext.getBuildCellRootPath(), filesystem, annotationGenFolder))); buildableContext.recordArtifact(annotationGenFolder); }
Example 11
Source File: CompileToJarStepFactory.java From buck with Apache License 2.0 | 5 votes |
protected void createCompileToJarStepImpl( ProjectFilesystem projectFilesystem, BuildContext context, BuildTarget target, CompilerParameters compilerParameters, ImmutableList<String> postprocessClassesCommands, @Nullable JarParameters abiJarParameters, @Nullable JarParameters libraryJarParameters, /* output params */ Builder<Step> steps, BuildableContext buildableContext) { Preconditions.checkArgument(abiJarParameters == null); Preconditions.checkArgument( libraryJarParameters != null && libraryJarParameters .getEntriesToJar() .contains(compilerParameters.getOutputPaths().getClassesDir())); createCompileStep( context, projectFilesystem, target, compilerParameters, steps, buildableContext); steps.addAll( Lists.newCopyOnWriteArrayList( addPostprocessClassesCommands( projectFilesystem, postprocessClassesCommands, compilerParameters.getOutputPaths().getClassesDir(), compilerParameters.getClasspathEntries(), getBootClasspath(context)))); createJarStep(projectFilesystem, libraryJarParameters, steps); }
Example 12
Source File: CompileToJarStepFactory.java From buck with Apache License 2.0 | 5 votes |
protected void addJarSetupSteps( ProjectFilesystem projectFilesystem, BuildContext context, JarParameters jarParameters, Builder<Step> steps) { steps.addAll( MakeCleanDirectoryStep.of( BuildCellRelativePath.fromCellRelativePath( context.getBuildCellRootPath(), projectFilesystem, jarParameters.getJarPath().getParent()))); }
Example 13
Source File: Menu.java From molgenis with GNU Lesser General Public License v3.0 | 5 votes |
private List<String> prefixId(List<String> path) { if (path.size() == 2) { return path; } Builder<String> result = ImmutableList.builder(); result.add(getId()); result.addAll(path); return result.build(); }
Example 14
Source File: HttpRepositoryService.java From SquirrelID with GNU Lesser General Public License v3.0 | 5 votes |
@Override public ImmutableList<Profile> findAllByName(Iterable<String> names) throws IOException, InterruptedException { Builder<Profile> builder = ImmutableList.builder(); for (List<String> partition : Iterables.partition(names, MAX_NAMES_PER_REQUEST)) { builder.addAll(query(partition)); } return builder.build(); }
Example 15
Source File: MixinServiceAbstract.java From Mixin with MIT License | 5 votes |
/** * Collect mixin containers from platform agents */ protected final void getContainersFromAgents(Builder<IContainerHandle> list) { for (IMixinPlatformServiceAgent agent : this.getServiceAgents()) { Collection<IContainerHandle> containers = agent.getMixinContainers(); if (containers != null) { list.addAll(containers); } } }
Example 16
Source File: ArmeriaEurekaClientTest.java From armeria with Apache License 2.0 | 5 votes |
private static List<Endpoint> endpointsFromApplications(Applications applications, boolean secureVip) { final Builder<Endpoint> builder = ImmutableList.builder(); for (Application application : applications.getRegisteredApplications()) { builder.addAll(endpointsFromApplication(application, secureVip)); } return builder.build(); }
Example 17
Source File: AchievementNotifier.java From stendhal with GNU General Public License v2.0 | 5 votes |
/** * gets a list of all Achievements * * @return list of achievements */ public ImmutableList<Achievement> getAchievements() { Builder<Achievement> builder = ImmutableList.builder(); for (List<Achievement> temp : achievements.values()) { builder.addAll(temp); } return builder.build(); }
Example 18
Source File: SqlDialect.java From morf with Apache License 2.0 | 5 votes |
/** * Creates SQL to deploy a database table and its associated indexes. * * @param table The meta data for the table to deploy. * @return The statements required to deploy the table and its indexes. */ public Collection<String> tableDeploymentStatements(Table table) { Builder<String> statements = ImmutableList.<String>builder(); statements.addAll(internalTableDeploymentStatements(table)); for (Index index : table.indexes()) { statements.addAll(indexDeploymentStatements(table, index)); } return statements.build(); }
Example 19
Source File: NuoDBDialect.java From morf with Apache License 2.0 | 5 votes |
/** * When deploying a table need to ensure that an index doesn't already exist when creating it. * @see org.alfasoftware.morf.jdbc.SqlDialect#tableDeploymentStatements(org.alfasoftware.morf.metadata.Table) */ @Override public Collection<String> tableDeploymentStatements(Table table) { Builder<String> statements = ImmutableList.<String>builder(); statements.addAll(internalTableDeploymentStatements(table)); for (Index index : table.indexes()) { statements.add(optionalDropIndexStatement(table, index)); statements.addAll(indexDeploymentStatements(table, index)); } return statements.build(); }
Example 20
Source File: CompileToJarStepFactory.java From buck with Apache License 2.0 | 4 votes |
protected void addCompilerSetupSteps( BuildContext context, ProjectFilesystem projectFilesystem, BuildTarget target, CompilerParameters compilerParameters, ResourcesParameters resourcesParameters, Builder<Step> steps) { // Always create the output directory, even if there are no .java files to compile because there // might be resources that need to be copied there. steps.addAll( MakeCleanDirectoryStep.of( BuildCellRelativePath.fromCellRelativePath( context.getBuildCellRootPath(), projectFilesystem, compilerParameters.getOutputPaths().getClassesDir()))); steps.addAll( MakeCleanDirectoryStep.of( BuildCellRelativePath.fromCellRelativePath( context.getBuildCellRootPath(), projectFilesystem, compilerParameters.getOutputPaths().getAnnotationPath()))); steps.add( MkdirStep.of( BuildCellRelativePath.fromCellRelativePath( context.getBuildCellRootPath(), projectFilesystem, compilerParameters.getOutputPaths().getOutputJarDirPath()))); // If there are resources, then link them to the appropriate place in the classes directory. steps.add( new CopyResourcesStep( projectFilesystem, context, target, resourcesParameters, compilerParameters.getOutputPaths().getClassesDir())); if (!compilerParameters.getSourceFilePaths().isEmpty()) { steps.add( MkdirStep.of( BuildCellRelativePath.fromCellRelativePath( context.getBuildCellRootPath(), projectFilesystem, compilerParameters.getOutputPaths().getPathToSourcesList().getParent()))); steps.addAll( MakeCleanDirectoryStep.of( BuildCellRelativePath.fromCellRelativePath( context.getBuildCellRootPath(), projectFilesystem, compilerParameters.getOutputPaths().getWorkingDirectory()))); } }