return;
}
visitedClasses.add(type);
try {
Method[] methods = type.getDeclaredMethods();
CachingInjector injector = null;
for (Method method : methods) {
Converter annotation = method.getAnnotation(Converter.class);
if (annotation != null) {
Class<?>[] parameterTypes = method.getParameterTypes();
if (parameterTypes == null || parameterTypes.length != 1) {
LOG.warn("Ignoring bad converter on type: " + type.getName() + " method: " + method
+ " as a converter method should have one parameter");
} else {
int modifiers = method.getModifiers();
if (isAbstract(modifiers) || !isPublic(modifiers)) {
LOG.warn("Ignoring bad converter on type: " + type.getName() + " method: " + method
+ " as a converter method is not a public and concrete method");
} else {
Class toType = method.getReturnType();
if (toType.equals(Void.class)) {
LOG.warn("Ignoring bad converter on type: " + type.getName() + " method: "
+ method + " as a converter method returns a void method");
} else {
Class fromType = parameterTypes[0];
if (isStatic(modifiers)) {
registerTypeConverter(registry, method, toType, fromType,
new StaticMethodTypeConverter(method));
} else {
if (injector == null) {
injector = new CachingInjector(registry, type);
}
registerTypeConverter(registry, method, toType, fromType,
new InstanceMethodTypeConverter(injector, method));
}
}