@SuppressWarnings("unchecked") public B initConfigs(ConfigCustomizations clone) { inheritConfigs = clone.inheritConfigs; inheritModelOnlyConfigs = clone.inheritModelOnlyConfigs; includedModels = CollectionUtils.clone(clone.includedModels); includedConfigs = CollectionUtils.clone(clone.includedConfigs); excludedModels = CollectionUtils.clone(clone.excludedModels); excludedConfigs = CollectionUtils.clone(clone.excludedConfigs); definedConfigs = CollectionUtils.clone(clone.definedConfigs); hasModelOnlyConfigs = clone.hasModelOnlyConfigs; return (B) this; }
protected Builder(ConfigModel config) { super(config); this.model = config.getModel(); this.props = CollectionUtils.clone(config.props); this.configDeps = CollectionUtils.clone(config.configDeps); this.inheritLayers = config.inheritLayers; this.includedLayers = CollectionUtils.clone(config.includedLayers); this.excludedLayers = CollectionUtils.clone(config.excludedLayers); }
protected FeatureGroupBuilderSupport(FeatureGroupSupport fg) { super(fg); this.name = fg.name; this.origin = fg.origin; this.inheritFeatures = fg.inheritFeatures; this.includedSpecs = CollectionUtils.clone(fg.includedSpecs); this.includedFeatures = CollectionUtils.clone(fg.includedFeatures); this.excludedSpecs = CollectionUtils.clone(fg.excludedSpecs); this.excludedFeatures = CollectionUtils.clone(fg.excludedFeatures); if(!fg.externalFgConfigs.isEmpty()) { for(Map.Entry<String, FeatureGroup> entry : fg.externalFgConfigs.entrySet()) { externalFgConfigs = CollectionUtils.putLinked(externalFgConfigs, entry.getKey(), FeatureGroup.builder(entry.getValue())); } } this.items = CollectionUtils.clone(fg.items); }
ResolvedFeature copy(int includeNo) throws ProvisioningException { final ResolvedFeature copy = new ResolvedFeature(id, spec, params.size() > 1 ? new HashMap<>(params) : params, deps.size() > 1 ? new LinkedHashMap<>(deps) : deps, includeNo); if(!resetParams.isEmpty()) { copy.resetParams = CollectionUtils.clone(resetParams); } if(!unsetParams.isEmpty()) { copy.unsetParams = CollectionUtils.clone(unsetParams); } return copy; }
public static <T> Set<T> addAll(Set<T> dest, Set<T> src) { if(dest.isEmpty()) { return clone(src); } if(src.isEmpty()) { return dest; } if(dest.size() == 1) { final Set<T> tmp = dest; dest = new HashSet<>(src.size() + 1); dest.addAll(tmp); } dest.addAll(src); return dest; }
public static <T> List<T> addAll(List<T> dest, List<T> src) { if(dest.isEmpty()) { return clone(src); } if(src.isEmpty()) { return dest; } if(dest.size() == 1) { final T first = dest.get(0); dest = new ArrayList<>(src.size() + 1); dest.add(first); } dest.addAll(src); return dest; }
public Builder init(FeaturePackConfig fpConfig) { super.initConfigs(fpConfig); inheritPackages = fpConfig.inheritPackages; excludedPackages = CollectionUtils.clone(fpConfig.excludedPackages); includedPackages = CollectionUtils.clone(fpConfig.includedPackages); transitive = fpConfig.transitive; if(!fpConfig.patches.isEmpty()) { if(fpConfig.patches.size() == 1) { patches = Collections.singleton(fpConfig.patches.get(0)); } else { patches = new LinkedHashSet<>(fpConfig.patches.size()); for(FPID patchId : fpConfig.patches) { patches.add(patchId); } } } return this; }
private <O extends FeaturePackLayout> ProvisioningLayout(ProvisioningLayout<O> other, FeaturePackLayoutFactory<F> fpFactory, FeaturePackLayoutTransformer<F, O> transformer) throws ProvisioningException { this.layoutFactory = other.layoutFactory; this.fpFactory = fpFactory; this.config = other.config; this.options = CollectionUtils.clone(other.options); // feature-packs are processed in the reverse order and then re-ordered again // this is necessary to properly analyze and include optional package and their external dependencies int i = other.ordered.size(); ordered.ensureCapacity(i); while(--i >= 0) { final O otherFp = other.ordered.get(i); final F fp = transformer.transform(otherFp); featurePacks.put(fp.getFPID().getProducer(), fp); ordered.add(fp); } Collections.reverse(ordered); if(!other.fpPatches.isEmpty()) { fpPatches = new HashMap<>(other.fpPatches.size()); for (Map.Entry<FPID, List<O>> patchEntry : other.fpPatches.entrySet()) { final List<O> patches = patchEntry.getValue(); final List<F> convertedPatches = new ArrayList<>(patches.size()); for(O o : patches) { convertedPatches.add(transformer.transform(o)); } fpPatches.put(patchEntry.getKey(), convertedPatches); } } this.handle = other.handle; handle.incrementRefs(); }
final Map<String, Object> clone = col.size() == 1 ? idParams : CollectionUtils.clone(idParams); paramsList.set(i, CollectionUtils.put(clone, refParamName, item)); continue; paramsList.add(CollectionUtils.put(CollectionUtils.clone(idParams), refParamName, item)); final Map<String, Object> clone = col.size() == 1 ? idParams : CollectionUtils.clone(idParams); paramsList.set(i, CollectionUtils.put(clone, refParamName, item)); continue; paramsList.add(CollectionUtils.put(CollectionUtils.clone(idParams), refParamName, item));
private void initPluginOptions(Map<String, String> extraOptions, boolean cleanupConfigOptions) throws ProvisioningException { options = config.getOptions(); if(!extraOptions.isEmpty()) { options = CollectionUtils.putAll(CollectionUtils.clone(options), extraOptions);