List of usage examples for com.google.common.collect ImmutableMap copyOf
public static <K, V> ImmutableMap<K, V> copyOf(Iterable<? extends Entry<? extends K, ? extends V>> entries)
From source file:io.brooklyn.camp.spi.resolve.interpret.PlanInterpretationContext.java
public PlanInterpretationContext(Map<String, Object> originalDeploymentPlan, List<PlanInterpreter> interpreters) { super();// w w w.j a v a2s . c o m this.originalDeploymentPlan = ImmutableMap.copyOf(originalDeploymentPlan); this.interpreters = ImmutableList.copyOf(interpreters); this.allInterpreter = new PlanInterpreter() { @Override public boolean isInterestedIn(PlanInterpretationNode node) { return true; } @Override public void applyYamlPrimitive(PlanInterpretationNode node) { for (PlanInterpreter i : PlanInterpretationContext.this.interpreters) { if (node.isExcluded()) break; if (i.isInterestedIn(node)) { i.applyYamlPrimitive(node); } } } @Override public boolean applyMapBefore(PlanInterpretationNode node, Map<Object, Object> mapIn) { boolean result = true; for (PlanInterpreter i : PlanInterpretationContext.this.interpreters) { if (node.isExcluded()) break; if (i.isInterestedIn(node)) { boolean ri = i.applyMapBefore(node, mapIn); result &= ri; } } return result; } @Override public boolean applyMapEntry(PlanInterpretationNode node, Map<Object, Object> mapIn, Map<Object, Object> mapOut, PlanInterpretationNode key, PlanInterpretationNode value) { boolean result = true; for (PlanInterpreter i : PlanInterpretationContext.this.interpreters) { if (node.isExcluded()) break; if (i.isInterestedIn(key)) { boolean ri = i.applyMapEntry(node, mapIn, mapOut, key, value); result &= ri; } } return result; } @Override public void applyMapAfter(PlanInterpretationNode node, Map<Object, Object> mapIn, Map<Object, Object> mapOut) { for (PlanInterpreter i : PlanInterpretationContext.this.interpreters) { if (node.isExcluded()) break; if (i.isInterestedIn(node)) { i.applyMapAfter(node, mapIn, mapOut); } } } @Override public boolean applyListBefore(PlanInterpretationNode node, List<Object> listIn) { boolean result = true; for (PlanInterpreter i : PlanInterpretationContext.this.interpreters) { if (node.isExcluded()) break; if (i.isInterestedIn(node)) { boolean ri = i.applyListBefore(node, listIn); result &= ri; } } return result; } @Override public boolean applyListEntry(PlanInterpretationNode node, List<Object> listIn, List<Object> listOut, PlanInterpretationNode value) { boolean result = true; for (PlanInterpreter i : PlanInterpretationContext.this.interpreters) { if (node.isExcluded()) break; if (i.isInterestedIn(value)) { boolean ri = i.applyListEntry(node, listIn, listOut, value); result &= ri; } } return result; } @Override public void applyListAfter(PlanInterpretationNode node, List<Object> listIn, List<Object> listOut) { for (PlanInterpreter i : PlanInterpretationContext.this.interpreters) { if (node.isExcluded()) break; if (i.isInterestedIn(node)) { i.applyListAfter(node, listIn, listOut); } } } }; }
From source file:com.opengamma.financial.aggregation.PortfolioAggregationFunctions.java
/** * Gets the aggregators mapped by name./* w ww. java 2s .c o m*/ * * @return the immutable map of aggregation functions, not null */ public Map<String, AggregationFunction<?>> getMappedFunctions() { Map<String, AggregationFunction<?>> result = new HashMap<String, AggregationFunction<?>>(); for (AggregationFunction<?> portfolioAggregator : _functions) { result.put(portfolioAggregator.getName(), portfolioAggregator); } return ImmutableMap.copyOf(result); }
From source file:org.sosy_lab.cpachecker.util.predicates.z3.matching.SmtAstPatternSelectionImpl.java
public SmtAstPatternSelectionImpl(LogicalConnection pRelation, Iterable<SmtAstPattern> pDisjuncts, Map<String, Formula> pDefaultBindings) { this.relation = pRelation; this.patterns = ImmutableList.copyOf(pDisjuncts); this.defaultBindings = ImmutableMap.copyOf(pDefaultBindings); }
From source file:org.elasticsearch.test.rest.section.ApiCallSection.java
public Map<String, String> getParams() { //make sure we never modify the parameters once returned return ImmutableMap.copyOf(params); }
From source file:org.apache.drill.exec.server.options.FragmentOptionsManager.java
public FragmentOptionsManager(OptionManager systemOptions, OptionList options) { Map<String, OptionValue> tmp = Maps.newHashMap(); for (OptionValue v : options) { tmp.put(v.name, v);// w ww . ja v a 2s . co m } this.options = ImmutableMap.copyOf(tmp); this.systemOptions = systemOptions; }
From source file:org.pathirage.freshet.data.StreamElement.java
public StreamElement(Map<String, Object> fields, long globalClock, long timestamp, String id) { this.globalClock = globalClock; this.timestamp = timestamp; this.id = id; this.fields = ImmutableMap.copyOf(fields); }
From source file:com.flipkart.flux.persistence.impl.SessionFactoryContextImpl.java
public SessionFactoryContextImpl(Map<DataSourceType, SessionFactory> sessionFactoryMap, DataSourceType defaultType) {//from www. java2 s. co m this.sessionFactoryImmutableMap = ImmutableMap.copyOf(sessionFactoryMap); this.defaultDataSourceType = defaultType; assert sessionFactoryImmutableMap.get(defaultDataSourceType) != null : "DataSource of type " + defaultDataSourceType.name() + " not configured"; }
From source file:org.apache.brooklyn.rest.domain.AccessSummary.java
public AccessSummary(@JsonProperty("locationProvisioningAllowed") boolean locationProvisioningAllowed, @JsonProperty("links") Map<String, URI> links) { this.locationProvisioningAllowed = locationProvisioningAllowed; this.links = (links == null) ? ImmutableMap.<String, URI>of() : ImmutableMap.copyOf(links); }
From source file:net.derquinse.common.util.zip.LoadedZipFile.java
/** Constructor. */ LoadedZipFile(MemoryByteSourceLoader loader, Map<String, ? extends MemoryByteSource> entries) { this.loader = checkLoader(loader); this.entryMap = ImmutableMap.copyOf(entries); }
From source file:io.prestosql.decoder.json.JsonRowDecoder.java
JsonRowDecoder(ObjectMapper objectMapper, Map<DecoderColumnHandle, JsonFieldDecoder> fieldDecoders) { this.objectMapper = requireNonNull(objectMapper, "objectMapper is null"); this.fieldDecoders = ImmutableMap.copyOf(fieldDecoders); }