use of jodd.introspector.CachingIntrospector in project jodd by oblac.
the class BeanPrefixTest method testFieldPrefix2.
@Test
public void testFieldPrefix2() {
BeanUtilBean beanUtilBean = new BeanUtilBean();
LifeBean lifeBean = new LifeBean();
String bar = beanUtilBean.getProperty(lifeBean, "bar").toString();
assertEquals("bar", bar);
beanUtilBean.setIntrospector(new CachingIntrospector(true, true, true, new String[] { "_" }));
bar = beanUtilBean.getProperty(lifeBean, "bar").toString();
assertEquals("_bar", bar);
}
use of jodd.introspector.CachingIntrospector in project jodd by oblac.
the class BeanPrefixTest method testFieldPrefix1.
@Test
public void testFieldPrefix1() {
LifeBean lifeBean = new LifeBean();
String foo = BeanUtil.pojo.getProperty(lifeBean, "foo").toString();
assertEquals("foo", foo);
JoddIntrospector.introspector = new CachingIntrospector(true, true, true, new String[] { "_" });
foo = BeanUtil.pojo.getProperty(lifeBean, "foo").toString();
assertEquals("foo", foo);
ClassDescriptor cd = JoddIntrospector.introspector.lookup(LifeBean.class);
PropertyDescriptor[] pds = cd.getAllPropertyDescriptors();
assertEquals(3, pds.length);
assertEquals("bar", pds[0].getName());
assertEquals("_bar", pds[0].getFieldDescriptor().getName());
assertEquals("www", pds[2].getName());
assertEquals(null, pds[2].getFieldDescriptor());
JoddIntrospector.introspector = new CachingIntrospector();
}
use of jodd.introspector.CachingIntrospector in project jodd by oblac.
the class BeanPrefixTest method testFieldPrefix1withEmpty.
@Test
public void testFieldPrefix1withEmpty() {
LifeBean lifeBean = new LifeBean();
String foo = BeanUtil.pojo.getProperty(lifeBean, "foo").toString();
assertEquals("foo", foo);
JoddIntrospector.introspector = new CachingIntrospector(true, true, true, new String[] { "_", "" });
foo = BeanUtil.pojo.getProperty(lifeBean, "foo").toString();
assertEquals("foo", foo);
ClassDescriptor cd = JoddIntrospector.introspector.lookup(LifeBean.class);
PropertyDescriptor[] pds = cd.getAllPropertyDescriptors();
assertEquals(3, pds.length);
assertEquals("bar", pds[0].getName());
assertEquals("_bar", pds[0].getFieldDescriptor().getName());
assertEquals("www", pds[2].getName());
assertEquals("www", pds[2].getFieldDescriptor().getName());
JoddIntrospector.introspector = new CachingIntrospector();
}
Aggregations