@Test public void testPrimitiveAdapt() { assertEquals(BeanAdapter.adapt(null, Byte.TYPE), Byte.valueOf((byte)0)); assertEquals(BeanAdapter.adapt("1", Byte.TYPE), Byte.valueOf((byte)1)); assertEquals(BeanAdapter.adapt(null, Short.TYPE), Short.valueOf((short)0)); assertEquals(BeanAdapter.adapt("2", Short.TYPE), Short.valueOf((short)2)); assertEquals(BeanAdapter.adapt(null, Integer.TYPE), Integer.valueOf(0)); assertEquals(BeanAdapter.adapt("3", Integer.TYPE), Integer.valueOf(3)); assertEquals(BeanAdapter.adapt(null, Long.TYPE), Long.valueOf(0)); assertEquals(BeanAdapter.adapt("4", Long.TYPE), Long.valueOf(4)); assertEquals(BeanAdapter.adapt(null, Float.TYPE), Float.valueOf(0)); assertEquals(BeanAdapter.adapt("5.0", Float.TYPE), Float.valueOf(5)); assertEquals(BeanAdapter.adapt(null, Double.TYPE), Double.valueOf(0)); assertEquals(BeanAdapter.adapt("6.0", Double.TYPE), Double.valueOf(6)); assertEquals(BeanAdapter.adapt(null, Boolean.TYPE), Boolean.FALSE); assertEquals(BeanAdapter.adapt("true", Boolean.TYPE), Boolean.TRUE); }
@SuppressWarnings("unchecked") public static <T> T adapt(Object value) { return (T)adapt(value, new HashMap<>()); }
BeanAdapter extends AbstractMap<String, Object> { @SuppressWarnings("unchecked") public static <T> T adapt(Object value) { return (T)adapt(value, new HashMap<>()); } }
BeanAdapter extends AbstractMap<String, Object> { @SuppressWarnings("unchecked") public static <T> T adapt(Object value) { return (T)adapt(value, new HashMap<>()); } BeanAdapter(Object bean); private  BeanAdapter(Object bean, HashMap<Class<?>, HashMap<String, Method>> accessorCache); }
BeanAdapter extends AbstractMap<String, Object> { @SuppressWarnings("unchecked") public static <T> T adapt(Object value) { return (T)adapt(value, new HashMap<>()); } BeanAdapter(Object bean); private  BeanAdapter(Object bean, HashMap<Class<?>, HashMap<String, Method>> accessorCache); @Override Object get(Object key); @Override Set<Entry<String, Object>> entrySet(); @SuppressWarnings("unchecked") static T adapt(Object value); @SuppressWarnings("unchecked") static T adapt(Object value, Type type); static List<E> adaptList(List<?> list, Type elementType); static Map<K, V> adaptMap(Map<K, ?> map, Type valueType); @SuppressWarnings("unchecked") static V valueAt(Object root, String path); static String describe(Type type, Map<Class<?>, String> structures); }
BeanAdapter extends AbstractMap<String, Object> { @SuppressWarnings("unchecked") public static <T> T adapt(Object value) { return (T)adapt(value, new HashMap<>()); } BeanAdapter(Object bean); private  BeanAdapter(Object bean, HashMap<Class<?>, HashMap<String, Method>> accessorCache); @Override Object get(Object key); @Override Set<Entry<String, Object>> entrySet(); @SuppressWarnings("unchecked") static T adapt(Object value); @SuppressWarnings("unchecked") static T adapt(Object value, Type type); static List<E> adaptList(List<?> list, Type elementType); static Map<K, V> adaptMap(Map<K, ?> map, Type valueType); @SuppressWarnings("unchecked") static V valueAt(Object root, String path); static String describe(Type type, Map<Class<?>, String> structures);  }