@BenchmarkOptions(benchmarkRounds = 100, warmupRounds = 1) @Test public void createDynamicAccessor() { DynamicAccessor<User> userAccessor = DynamicAccessorFactory.create(User.class); Assert.assertNotNull(userAccessor); Object user = userAccessor.newInstance(); userAccessor.setProperty(user, "email", "sunghyouk.bae@gmail.com"); Assert.assertEquals("sunghyouk.bae@gmail.com", userAccessor.getProperty(user, "email")); }
@SuppressWarnings("unchecked") public static <T> DynamicAccessor<T> create(Class<T> targetType) { try { return (DynamicAccessor<T>) cache.get(targetType); } catch (ExecutionException e) { log.error("DynamicAccessor 를 생성하는데 실패했습니다. targetType=" + targetType.getName(), e); return null; } }
DynamicAccessorFactory { @SuppressWarnings("unchecked") public static <T> DynamicAccessor<T> create(Class<T> targetType) { try { return (DynamicAccessor<T>) cache.get(targetType); } catch (ExecutionException e) { log.error("DynamicAccessor 를 생성하는데 실패했습니다. targetType=" + targetType.getName(), e); return null; } } }
DynamicAccessorFactory { @SuppressWarnings("unchecked") public static <T> DynamicAccessor<T> create(Class<T> targetType) { try { return (DynamicAccessor<T>) cache.get(targetType); } catch (ExecutionException e) { log.error("DynamicAccessor 를 생성하는데 실패했습니다. targetType=" + targetType.getName(), e); return null; } }  }
DynamicAccessorFactory { @SuppressWarnings("unchecked") public static <T> DynamicAccessor<T> create(Class<T> targetType) { try { return (DynamicAccessor<T>) cache.get(targetType); } catch (ExecutionException e) { log.error("DynamicAccessor 를 생성하는데 실패했습니다. targetType=" + targetType.getName(), e); return null; } }  @SuppressWarnings("unchecked") static DynamicAccessor<T> create(Class<T> targetType); static synchronized void clear(); }
DynamicAccessorFactory { @SuppressWarnings("unchecked") public static <T> DynamicAccessor<T> create(Class<T> targetType) { try { return (DynamicAccessor<T>) cache.get(targetType); } catch (ExecutionException e) { log.error("DynamicAccessor 를 생성하는데 실패했습니다. targetType=" + targetType.getName(), e); return null; } }  @SuppressWarnings("unchecked") static DynamicAccessor<T> create(Class<T> targetType); static synchronized void clear();  }