@Test public void testSimpleBuilderAllParameters() throws Exception { TestSimpleBuilder expected = TestSimpleBuilder.builder().stringL1("l1").longVal(10L).build(); BuilderDynaBean builderDynaBean = new BuilderDynaBean(TestSimpleBuilder.class, convertUtilsBean); utilsBean.setProperty(builderDynaBean, "stringL1", expected.stringL1); utilsBean.setProperty(builderDynaBean, "longVal", expected.longVal); TestSimpleBuilder actual = builderDynaBean.build(TestSimpleBuilder.class); assertThat(actual, equalTo(expected)); }
@SafeVarargs public final <T> T build(Class<T> expected, Function<Object, Object>... additionalMutators) { if (emptyPropertyResolved != null) { validatedExpectedClass(emptyPropertyResolved.getClass(), expected); return expected.cast(emptyPropertyResolved); } if (dynaBeanBuilderSupport == null && dynaBeanCreateSupport == null) { return null; } validatedExpectedClass(destinedClass, expected); if (dynaBeanBuilderSupport.isValid()) { return expected.cast(dynaBeanBuilderSupport.build(additionalMutators)); } else { return expected.cast(dynaBeanCreateSupport.build()); } }
BuilderDynaBean implements DynaBean { @SafeVarargs public final <T> T build(Class<T> expected, Function<Object, Object>... additionalMutators) { if (emptyPropertyResolved != null) { validatedExpectedClass(emptyPropertyResolved.getClass(), expected); return expected.cast(emptyPropertyResolved); } if (dynaBeanBuilderSupport == null && dynaBeanCreateSupport == null) { return null; } validatedExpectedClass(destinedClass, expected); if (dynaBeanBuilderSupport.isValid()) { return expected.cast(dynaBeanBuilderSupport.build(additionalMutators)); } else { return expected.cast(dynaBeanCreateSupport.build()); } } }
BuilderDynaBean implements DynaBean { @SafeVarargs public final <T> T build(Class<T> expected, Function<Object, Object>... additionalMutators) { if (emptyPropertyResolved != null) { validatedExpectedClass(emptyPropertyResolved.getClass(), expected); return expected.cast(emptyPropertyResolved); } if (dynaBeanBuilderSupport == null && dynaBeanCreateSupport == null) { return null; } validatedExpectedClass(destinedClass, expected); if (dynaBeanBuilderSupport.isValid()) { return expected.cast(dynaBeanBuilderSupport.build(additionalMutators)); } else { return expected.cast(dynaBeanCreateSupport.build()); } } BuilderDynaBean(Class<?> destinedClass, ConvertUtilsBean convertUtilsBean, String... classPrefixSearchList);  BuilderDynaBean(Class<?> destinedClass, ConvertUtilsBean convertUtilsBean,
            Function<String, ?> emptyPropertyHandler, String... classPrefixSearchList);  BuilderDynaBean(Class<?> destinedClass, ConvertUtilsBean convertUtilsBean,
            Function<String, ?> emtpyPropertyHandler, List<String> classPrefixSearchList); }
BuilderDynaBean implements DynaBean { @SafeVarargs public final <T> T build(Class<T> expected, Function<Object, Object>... additionalMutators) { if (emptyPropertyResolved != null) { validatedExpectedClass(emptyPropertyResolved.getClass(), expected); return expected.cast(emptyPropertyResolved); } if (dynaBeanBuilderSupport == null && dynaBeanCreateSupport == null) { return null; } validatedExpectedClass(destinedClass, expected); if (dynaBeanBuilderSupport.isValid()) { return expected.cast(dynaBeanBuilderSupport.build(additionalMutators)); } else { return expected.cast(dynaBeanCreateSupport.build()); } } BuilderDynaBean(Class<?> destinedClass, ConvertUtilsBean convertUtilsBean, String... classPrefixSearchList);  BuilderDynaBean(Class<?> destinedClass, ConvertUtilsBean convertUtilsBean,
            Function<String, ?> emptyPropertyHandler, String... classPrefixSearchList);  BuilderDynaBean(Class<?> destinedClass, ConvertUtilsBean convertUtilsBean,
            Function<String, ?> emtpyPropertyHandler, List<String> classPrefixSearchList); boolean canBuildOrCreate(); @SafeVarargs final T build(Class<T> expected, Function<Object, Object>... additionalMutators); @Override boolean contains(String name, String key); @Override Object get(String name); @Override Object get(String name, int index); @Override Object get(String name, String key); @Override DynaClass getDynaClass(); @Override void remove(String name, String key); @Override void set(String name, Object value); @Override void set(String name, int index, Object value); @Override void set(String name, String key, Object value); }
BuilderDynaBean implements DynaBean { @SafeVarargs public final <T> T build(Class<T> expected, Function<Object, Object>... additionalMutators) { if (emptyPropertyResolved != null) { validatedExpectedClass(emptyPropertyResolved.getClass(), expected); return expected.cast(emptyPropertyResolved); } if (dynaBeanBuilderSupport == null && dynaBeanCreateSupport == null) { return null; } validatedExpectedClass(destinedClass, expected); if (dynaBeanBuilderSupport.isValid()) { return expected.cast(dynaBeanBuilderSupport.build(additionalMutators)); } else { return expected.cast(dynaBeanCreateSupport.build()); } } BuilderDynaBean(Class<?> destinedClass, ConvertUtilsBean convertUtilsBean, String... classPrefixSearchList);  BuilderDynaBean(Class<?> destinedClass, ConvertUtilsBean convertUtilsBean,
            Function<String, ?> emptyPropertyHandler, String... classPrefixSearchList);  BuilderDynaBean(Class<?> destinedClass, ConvertUtilsBean convertUtilsBean,
            Function<String, ?> emtpyPropertyHandler, List<String> classPrefixSearchList); boolean canBuildOrCreate(); @SafeVarargs final T build(Class<T> expected, Function<Object, Object>... additionalMutators); @Override boolean contains(String name, String key); @Override Object get(String name); @Override Object get(String name, int index); @Override Object get(String name, String key); @Override DynaClass getDynaClass(); @Override void remove(String name, String key); @Override void set(String name, Object value); @Override void set(String name, int index, Object value); @Override void set(String name, String key, Object value);  }