private Converter tryToCreateFactoryConverter(Class sourceType, Class targetType) {
{
String methodName = StringUtil.uncapitalize(targetType.getSimpleName()) + "Value";
Method typeValueMethod = BeanUtil.findMethod(sourceType, methodName, new Class[0]);
if (typeValueMethod != null && (typeValueMethod.getModifiers() & Modifier.STATIC) == 0)
return new SourceClassMethodInvoker(sourceType, targetType, typeValueMethod);
}
{
Method getInstanceMethod = BeanUtil.findMethod(targetType, "getInstance", sourceType);
if (getInstanceMethod != null && (getInstanceMethod.getModifiers() & Modifier.STATIC) == Modifier.STATIC)
return new StaticTargetClassMethodInvoker(sourceType, targetType, getInstanceMethod);
}
{
Method valueOfMethod = BeanUtil.findMethod(targetType, "valueOf", sourceType);
if (valueOfMethod != null && (valueOfMethod.getModifiers() & Modifier.STATIC) == Modifier.STATIC)
return new StaticTargetClassMethodInvoker(sourceType, targetType, valueOfMethod);
}
{
Constructor constructor = BeanUtil.findConstructor(targetType, sourceType);
if (constructor != null)
return new ConstructorInvoker(sourceType, constructor);
}
return findPoorConfiguredMatch(sourceType, targetType);
}