for (Field field : fields) {
ClassProperty property = new ClassProperty();
property.setKlass(klass);
String propertyName = field.getName();
if (field.isAnnotationPresent(JSONName.class)) {
JSONName jsonName = (JSONName) field.getAnnotation(JSONName.class);
propertyName = jsonName.value();
}
if (field.isAnnotationPresent(JSONCollector.class)) {
property.setCollector(true);
}
property.setPropertyName(propertyName);
property.registerAccessor(field);
property.registorMutator(field);
propertyMap.put(propertyName, property);
}
Method[] methods = klass.getDeclaredMethods();
for (Method method : methods) {
char ch;
String propertyName = null;
String methodName = method.getName();
boolean collector = false;
Class<?> returnType = method.getReturnType();
if (methodName.length() > IS_PREFIX.length() && methodName.startsWith(IS_PREFIX) && returnType == boolean.class && Character.isUpperCase(ch = methodName.charAt(IS_PREFIX.length()))) {
if (method.isAnnotationPresent(JSONName.class)) {
JSONName jsonName = (JSONName) method.getAnnotation(JSONName.class);
propertyName = jsonName.value();
} else {
propertyName = Character.toLowerCase(ch) + methodName.substring(IS_PREFIX.length() + 1, methodName.length());
}
if (method.isAnnotationPresent(JSONCollector.class)) {
collector = true;