public Stage createClone() { return CLONER.deepClone(this); }
private static void doReg(Cloner cl, IFastCloner fc, Class<?> c) { if (c != null) cl.registerFastCloner(c, fc); }
public void usingTemplate(PipelineTemplateConfig pipelineTemplate) { this.addAll(CLONER.deepClone(pipelineTemplate)); this.templateApplied = true; }
@Override public CruiseConfig cloneForValidation() { Cloner cloner = new Cloner(); BasicCruiseConfig configForValidation = cloner.deepClone(BasicCruiseConfig.this); // This needs to be done clear the cached fields else the cloned object will all get them. configForValidation.resetAllPipelineConfigsCache(); return configForValidation; }
public ParamResolver applyOver(ParamResolver enclosingScope) { return enclosingScope.override(CLONER.deepClone(params)); }
public static PipelineConfig renamePipeline(PipelineConfig oldConfig, String newPipelineName) { PipelineConfig newConfig = new Cloner().deepClone(oldConfig); HashMap attributes = new HashMap(); attributes.put(PipelineConfig.NAME, newPipelineName); newConfig.setConfigAttributes(attributes); return newConfig; }
/** * @return */ public SameDiff dup() { Cloner cloner = newCloner(); return cloner.deepClone(this); }
/** * Duplicate this function * @return */ public DifferentialFunction dup() { Cloner cloner = SameDiff.newCloner(); return cloner.deepClone(this); }
@Test public void shouldBeAbleToCreateACopyOfItself() { Resource existingResource = new Resource("some-name"); existingResource.setId(2); existingResource.setBuildId(10); assertThat(existingResource, equalTo(new Resource(existingResource))); assertThat(existingResource, equalTo(new Cloner().deepClone(existingResource))); } }
/** * Make copy of InsnNode object. */ public InsnNode copy() { if (this.getClass() == InsnNode.class) { return copyCommonParams(new InsnNode(insnType, getArgsCount())); } return INSN_CLONER.deepClone(this); } }
HeapItem(HeapItem other) { value = cloner.deepClone(other.getValue()); type = other.getType(); }
public PipelineConfig duplicate() { PipelineConfig clone = CLONER.deepClone(this); clone.name = new CaseInsensitiveString(""); clearSelfPipelineNameInFetchTask(clone); return clone; }
private HeapItem cloneItem(HeapItem original) { Object cloneValue = cloner.deepClone(original.getValue()); return new HeapItem(cloneValue, original.getType()); }
private void cacheActiveJob(ActiveJob activeJob) { goCache.put(cacheKeyForActiveJob(activeJob.getId()), cloner.deepClone(activeJob));//TODO: we should clone while serving the object out, and not while adding it to cache }
public JobInstance buildByIdWithTransitions(long buildInstanceId) { String cacheKey = cacheKeyForJobInstanceWithTransitions(buildInstanceId); synchronized (cacheKey) { JobInstance instance = (JobInstance) goCache.get(cacheKey); if (instance == null) { instance = job(buildInstanceId, "buildByIdWithTransitions"); goCache.put(cacheKey, instance); } return cloner.deepClone(instance); } }
@Before public void before() { original = CLONER.deepClone(System.getProperties()); systemEnvironment = new SystemEnvironment(); }
public ParamsConfig referredParams() { ParamReferenceCollectorFactory paramHandlerFactory = new ParamReferenceCollectorFactory(); new ParamResolver(paramHandlerFactory, FIELD_CACHE).resolve(CLONER.deepClone(this)); ParamsConfig paramsConfig = new ParamsConfig(); for (String param : paramHandlerFactory.referredParams()) { paramsConfig.add(new ParamConfig(param, null)); } return paramsConfig; }