BeanPropertyAccessor { public static BeanPropertyAccessor forClass(Class<?> clazz) { synchronized (cAccessors) { BeanPropertyAccessor bpa = cAccessors.get(clazz); if (bpa != null) { return bpa; } bpa = generate(clazz); cAccessors.put(clazz, bpa); return bpa; } } protected  BeanPropertyAccessor(); static BeanPropertyAccessor forClass(Class<?> clazz); abstract Object getPropertyValue(Object bean, String property); abstract void setPropertyValue(Object bean, String property,
                                          Object value);  }
@Test public void testForClass() { BeanPropertyAccessor accessor = BeanPropertyAccessor.forClass(MyObject.class); assertNotNull("accessor invalid", accessor); BeanPropertyAccessor cached = BeanPropertyAccessor.forClass(MyObject.class); assertSame("accessor not cached", accessor, cached); }