use of com.fasterxml.jackson.databind.PropertyName in project jackson-module-afterburner by FasterXML.
the class TestAccessorGeneration method testDualIntAccessorGeneration.
public void testDualIntAccessorGeneration() throws Exception {
PropertyAccessorCollector coll = new PropertyAccessorCollector(Bean3.class);
String[] methodNames = new String[] { "getX", "getY", "get3" };
for (String methodName : methodNames) {
Method method = Bean3.class.getDeclaredMethod(methodName);
AnnotatedMethod annMethod = new AnnotatedMethod(null, method, null, null);
// should we translate from method name to property name?
coll.addIntGetter(new BeanPropertyWriter(SimpleBeanPropertyDefinition.construct(null, annMethod, new PropertyName(methodName)), annMethod, null, null, null, null, null, false, null));
}
BeanPropertyAccessor acc = coll.findAccessor(null);
Bean3 bean = new Bean3();
assertEquals(bean.getX(), acc.intGetter(bean, 0));
assertEquals(bean.getY(), acc.intGetter(bean, 1));
assertEquals(bean.get3(), acc.intGetter(bean, 2));
}
Aggregations