@Test public void testClone() throws Exception { Object clone = deepCloneProcess.clone(def1); testPropertySet(clone, def1, nameProperty2, nameValue); testPropertySet(clone, def1, textProperty2, textValue); testPropertySet(clone, def1, booleanProperty2, booleanValue); }
@Override @SuppressWarnings("all") public <S, T> T clone(final S source, final T target) { final AdapterRegistry adapters = adapterManager.registry(); final DefinitionAdapter<Object> sourceDefinitionAdapter = adapters.getDefinitionAdapter(source.getClass()); for (String field : sourceDefinitionAdapter.getPropertyFields(source)) { Optional<?> property = sourceDefinitionAdapter.getProperty(source, field); property.ifPresent(p -> { final Object value = adapters.getPropertyAdapter(p.getClass()).getValue(p); if (null != value && isAllowedToClone(value)) { Optional<?> targetProperty = adapters.getDefinitionAdapter(target.getClass()).getProperty(target, field); targetProperty.ifPresent(tp -> { final PropertyAdapter tpa = adapters.getPropertyAdapter(tp.getClass()); tpa.setValue(tp, value); }); } }); } return target; }
DeepCloneProcess extends AbstractCloneProcess implements IDeepCloneProcess { @Override @SuppressWarnings("all") public <S, T> T clone(final S source, final T target) { final AdapterRegistry adapters = adapterManager.registry(); final DefinitionAdapter<Object> sourceDefinitionAdapter = adapters.getDefinitionAdapter(source.getClass()); for (String field : sourceDefinitionAdapter.getPropertyFields(source)) { Optional<?> property = sourceDefinitionAdapter.getProperty(source, field); property.ifPresent(p -> { final Object value = adapters.getPropertyAdapter(p.getClass()).getValue(p); if (null != value && isAllowedToClone(value)) { Optional<?> targetProperty = adapters.getDefinitionAdapter(target.getClass()).getProperty(target, field); targetProperty.ifPresent(tp -> { final PropertyAdapter tpa = adapters.getPropertyAdapter(tp.getClass()); tpa.setValue(tp, value); }); } }); } return target; } }
DeepCloneProcess extends AbstractCloneProcess implements IDeepCloneProcess { @Override @SuppressWarnings("all") public <S, T> T clone(final S source, final T target) { final AdapterRegistry adapters = adapterManager.registry(); final DefinitionAdapter<Object> sourceDefinitionAdapter = adapters.getDefinitionAdapter(source.getClass()); for (String field : sourceDefinitionAdapter.getPropertyFields(source)) { Optional<?> property = sourceDefinitionAdapter.getProperty(source, field); property.ifPresent(p -> { final Object value = adapters.getPropertyAdapter(p.getClass()).getValue(p); if (null != value && isAllowedToClone(value)) { Optional<?> targetProperty = adapters.getDefinitionAdapter(target.getClass()).getProperty(target, field); targetProperty.ifPresent(tp -> { final PropertyAdapter tpa = adapters.getPropertyAdapter(tp.getClass()); tpa.setValue(tp, value); }); } }); } return target; } protected  DeepCloneProcess(); @Inject  DeepCloneProcess(final FactoryManager factoryManager,
                            final AdapterManager adapterManager,
                            final ClassUtils classUtils); }
DeepCloneProcess extends AbstractCloneProcess implements IDeepCloneProcess { @Override @SuppressWarnings("all") public <S, T> T clone(final S source, final T target) { final AdapterRegistry adapters = adapterManager.registry(); final DefinitionAdapter<Object> sourceDefinitionAdapter = adapters.getDefinitionAdapter(source.getClass()); for (String field : sourceDefinitionAdapter.getPropertyFields(source)) { Optional<?> property = sourceDefinitionAdapter.getProperty(source, field); property.ifPresent(p -> { final Object value = adapters.getPropertyAdapter(p.getClass()).getValue(p); if (null != value && isAllowedToClone(value)) { Optional<?> targetProperty = adapters.getDefinitionAdapter(target.getClass()).getProperty(target, field); targetProperty.ifPresent(tp -> { final PropertyAdapter tpa = adapters.getPropertyAdapter(tp.getClass()); tpa.setValue(tp, value); }); } }); } return target; } protected  DeepCloneProcess(); @Inject  DeepCloneProcess(final FactoryManager factoryManager,
                            final AdapterManager adapterManager,
                            final ClassUtils classUtils); @Override @SuppressWarnings("all") T clone(final S source,
                          final T target); }
DeepCloneProcess extends AbstractCloneProcess implements IDeepCloneProcess { @Override @SuppressWarnings("all") public <S, T> T clone(final S source, final T target) { final AdapterRegistry adapters = adapterManager.registry(); final DefinitionAdapter<Object> sourceDefinitionAdapter = adapters.getDefinitionAdapter(source.getClass()); for (String field : sourceDefinitionAdapter.getPropertyFields(source)) { Optional<?> property = sourceDefinitionAdapter.getProperty(source, field); property.ifPresent(p -> { final Object value = adapters.getPropertyAdapter(p.getClass()).getValue(p); if (null != value && isAllowedToClone(value)) { Optional<?> targetProperty = adapters.getDefinitionAdapter(target.getClass()).getProperty(target, field); targetProperty.ifPresent(tp -> { final PropertyAdapter tpa = adapters.getPropertyAdapter(tp.getClass()); tpa.setValue(tp, value); }); } }); } return target; } protected  DeepCloneProcess(); @Inject  DeepCloneProcess(final FactoryManager factoryManager,
                            final AdapterManager adapterManager,
                            final ClassUtils classUtils); @Override @SuppressWarnings("all") T clone(final S source,
                          final T target);  }