public void doWith(final Method method) {
if (method.getName().startsWith("get")
|| method.getName().startsWith("is")
&& !method.getName().equals("getClass")) {
Class retType = method.getReturnType();
PropertyType propType = getPropertyType(method);
if (isPrimitiveType(retType)) {
elementType.add(propType);
} else if (!retType.equals(java.lang.ClassLoader.class)
&& !retType.equals(java.lang.annotation.Annotation.class)
&& !retType.equals(java.lang.Class.class)) {
Class argType = retType;
if (retType.equals(java.util.List.class)) { // see above
final Class genArgType = getGenericArgType(method
.getGenericReturnType());
if (genArgType != null) {
argType = genArgType;
}
}
if (!elementType.hasReference(name)
&& !elementType.getName().equals(
argType.getCanonicalName())) {
if (isPrimitiveType(argType)) {
logger.debug("adding list property {}", name);
elementType.add(propType);
} else {
logger.debug("adding reference {} for {}",
argType.getCanonicalName(), propType.getName());
elementType.addReference(propType.getName(),
create(argType, idName, versionName));
}
}
}
}