### Question:
JavaBeanBinder extends BeanBinder { @Override public <T> T bind(final PropertyName name, final BindData<T> target, final Binder.Env env, final PropertyBinder propertyBinder) { boolean hasKnownBindableProperties = env.getSource().containsDescendantOf(name); Bean<T> bean = Bean.get(target, hasKnownBindableProperties); if (bean == null) { return null; } BeanSupplier<T> beanSupplier = bean.getSupplier(target); boolean bound = bind(propertyBinder, bean, beanSupplier); return bound ? beanSupplier.get() : null; }  @Override T bind(final PropertyName name, final BindData<T> target, final Binder.Env env, final PropertyBinder propertyBinder);  }### Answer:
@Test public void testJavaBeanBind() { String name = "hmily.yml"; Map<String, Object> map = new HashMap<>(); map.put("hmily.stringTest", "123"); map.put("hmily.integerTest", 456); map.put("hmily.doubleTest", 42.12); map.put("hmily.longTest", 100L); map.put("hmily.chartTest", 'a'); map.put("hmily.floatTest", 12.1F); map.put("hmily.boolTest", true); PropertyKeySource<?> propertySource = new MapPropertyKeySource(name, map); ConfigPropertySource configPropertySource = new DefaultConfigPropertySource<>(propertySource, PropertyKeyParse.INSTANCE); Binder binder = Binder.of(configPropertySource); BindData<JavaBeanBinderTest> data = BindData.of(DataType.of(JavaBeanBinderTest.class), JavaBeanBinderTest::new); JavaBeanBinderTest bind = binder.bind("hmily", data); Assert.assertEquals(map.get("hmily.stringTest"), bind.getStringTest()); Assert.assertEquals(map.get("hmily.integerTest"), bind.getIntegerTest()); Assert.assertEquals(map.get("hmily.doubleTest"), bind.getDoubleTest()); Assert.assertEquals(map.get("hmily.chartTest"), bind.getChartTest()); Assert.assertEquals(map.get("hmily.longTest"), bind.getLongTest()); Assert.assertEquals(map.get("hmily.floatTest"), bind.getFloatTest()); Assert.assertEquals(map.get("hmily.boolTest"), bind.getBoolTest()); }
@Test public void testJavaBeanBindParse() { String name = "hmily.yml"; Map<String, Object> map = new HashMap<>(); map.put("hmily.stringTest", 123); map.put("hmily.integerTest", "123"); map.put("hmily.doubleTest", "123"); map.put("hmily.longTest", "123"); map.put("hmily.chartTest", "A"); map.put("hmily.floatTest", "123"); map.put("hmily.boolTest", "true"); PropertyKeySource<?> propertySource = new MapPropertyKeySource(name, map); ConfigPropertySource configPropertySource = new DefaultConfigPropertySource<>(propertySource, PropertyKeyParse.INSTANCE); Binder binder = Binder.of(configPropertySource); BindData<JavaBeanBinderTest> data = BindData.of(DataType.of(JavaBeanBinderTest.class), JavaBeanBinderTest::new); JavaBeanBinderTest bind = binder.bind("hmily", data); Assert.assertEquals("123", bind.getStringTest()); Assert.assertEquals(Integer.valueOf(123), bind.getIntegerTest()); Assert.assertEquals(Double.valueOf(123), bind.getDoubleTest()); Assert.assertEquals(Character.valueOf('A'), bind.getChartTest()); Assert.assertEquals(Long.valueOf(123), bind.getLongTest()); Assert.assertEquals(Float.valueOf(123), bind.getFloatTest()); Assert.assertEquals(Boolean.TRUE, bind.getBoolTest()); }