List of usage examples for com.google.common.collect ImmutableList builder
public static <E> Builder<E> builder()
From source file:com.facebook.presto.sql.planner.SubExpressionExtractor.java
public static List<Expression> extractAll(Expression expression) { ImmutableList.Builder<Expression> builder = ImmutableList.builder(); extract(builder, expression);// w ww. j a va 2 s .c o m return builder.build(); }
From source file:org.apache.beam.runners.core.construction.TransformInputs.java
/** * Gets all inputs of the {@link AppliedPTransform} that are not returned by {@link * PTransform#getAdditionalInputs()}.//w w w . j a v a 2s. co m */ public static Collection<PValue> nonAdditionalInputs(AppliedPTransform<?, ?, ?> application) { ImmutableList.Builder<PValue> mainInputs = ImmutableList.builder(); PTransform<?, ?> transform = application.getTransform(); for (Map.Entry<TupleTag<?>, PValue> input : application.getInputs().entrySet()) { if (!transform.getAdditionalInputs().containsKey(input.getKey())) { mainInputs.add(input.getValue()); } } checkArgument(!mainInputs.build().isEmpty() || application.getInputs().isEmpty(), "Expected at least one main input if any inputs exist"); return mainInputs.build(); }
From source file:com.facebook.presto.sql.analyzer.ScopeReferenceExtractor.java
public static List<Expression> getReferencesToScope(Node node, Analysis analysis, Scope scope) { ImmutableList.Builder<Expression> builder = ImmutableList.builder(); new Visitor(analysis, scope).process(node, builder); return builder.build(); }
From source file:com.omnigon.aem.common.utils.ParserUtil.java
/** * * @param array incoming parameters//from w w w . j a v a 2 s .c o m * @param type type of Object to map * @param <T> - * @return Object with mapped parameters */ public static <T> ImmutableList<T> parseJsonArray(String[] array, Class<T> type) { final ImmutableList.Builder<T> builder = ImmutableList.builder(); final ObjectReader reader = OBJECT_MAPPER.reader(type); for (String element : ArrayUtils.nullToEmpty(array)) { try { builder.add(reader.<T>readValue(element)); } catch (IOException e) { LOGGER.warn(e.getMessage(), e); } } return builder.build(); }
From source file:com.facebook.buck.java.JavaLibraryRules.java
static void addAccumulateClassNamesStep(JavaLibrary javaLibrary, BuildableContext buildableContext, ImmutableList.Builder<Step> steps) { Preconditions.checkNotNull(javaLibrary); Path pathToClassHashes = JavaLibraryRules.getPathToClassHashes(javaLibrary.getBuildTarget()); steps.add(new MkdirStep(pathToClassHashes.getParent())); steps.add(new AccumulateClassNamesStep(Optional.fromNullable(javaLibrary.getPathToOutputFile()), pathToClassHashes));/*from w ww.j a va 2s .c om*/ buildableContext.recordArtifact(pathToClassHashes); }
From source file:com.google.currysrc.api.process.ast.BodyDeclarationLocators.java
public static List<BodyDeclarationLocator> createLocatorsFromStrings(String[] locatorStrings) { ImmutableList.Builder<BodyDeclarationLocator> locatorListBuilder = ImmutableList.builder(); for (String locatorString : locatorStrings) { BodyDeclarationLocator locator = BodyDeclarationLocators.fromStringForm(locatorString); locatorListBuilder.add(locator); }//from w w w .ja v a 2 s . com return locatorListBuilder.build(); }
From source file:com.tibco.businessworks6.sonar.plugin.ProcessExtensions.java
@SuppressWarnings("rawtypes") public static List getExtensions() { ImmutableList.Builder<Object> builder = ImmutableList.builder(); builder.add(ProcessLanguage.class); builder.add(ProcessSonarWayProfile.class); builder.add(ProcessRuleDefinition.class); builder.add(ProcessRuleSensor.class); //builder.add(ProcessMetricSensor.class); builder.add(PropertyDefinition.builder(ProcessLanguage.FILE_SUFFIXES_KEY) .defaultValue(StringUtils.join(ProcessLanguage.DEFAULT_FILE_SUFFIXES, ",")) .name("Process file suffixes").description("Comma-separated list of suffixes for files to analyze.") .category(BusinessWorksPlugin.TIBCO_BUSINESSWORK_CATEGORY).subCategory(SUB_CATEGORY_NAME) .onQualifiers(Qualifiers.PROJECT).build()); return builder.build(); }
From source file:com.facebook.buck.core.rules.knowntypes.KnownBuildRuleDescriptionsFactory.java
static ImmutableList<Description<?>> createBuildDescriptions(BuckConfig config, ProcessExecutor processExecutor, ToolchainProvider toolchainProvider, PluginManager pluginManager, SandboxExecutionStrategyFactory sandboxExecutionStrategyFactory) { ImmutableList.Builder<Description<?>> builder = ImmutableList.builder(); SandboxExecutionStrategy sandboxExecutionStrategy = sandboxExecutionStrategyFactory.create(processExecutor, config);/*from w w w .java 2 s . c om*/ DescriptionCreationContext descriptionCreationContext = DescriptionCreationContext.of(config, toolchainProvider, sandboxExecutionStrategy, pluginManager); List<DescriptionProvider> descriptionProviders = pluginManager.getExtensions(DescriptionProvider.class); for (DescriptionProvider provider : descriptionProviders) { builder.addAll(provider.getDescriptions(descriptionCreationContext)); } return builder.build(); }
From source file:org.basepom.mojo.propertyhelper.PropertyField.java
public static List<PropertyElement> createProperties(final Model model, final Map<String, String> values, final PropertyGroup propertyGroup) throws IOException, InterpolationException { checkNotNull(model, "model is null"); checkNotNull(values, "values is null"); checkNotNull(propertyGroup, "propertyGroup is null"); final InterpolatorFactory interpolatorFactory = new InterpolatorFactory(Optional.of(model)); final ImmutableList.Builder<PropertyElement> result = ImmutableList.builder(); final Map<String, String> properties = propertyGroup.getProperties(); for (String name : properties.keySet()) { final String value = propertyGroup.getPropertyValue(interpolatorFactory, name, values); result.add(new PropertyField(name, value)); }/*from ww w . ja va 2 s.c om*/ return result.build(); }
From source file:be.dnsbelgium.core.DomainName.java
public static DomainName of(String domainName) { String[] labels = StringUtils.splitPreserveAllTokens(domainName, '.'); ImmutableList.Builder<Label> builder = new ImmutableList.Builder<Label>(); for (String label : labels) { builder.add(Label.of(label)); }/* w w w . ja va2s . c o m*/ return new DomainName(builder.build()); }