in oas-generator/oas-generator-core/src/main/java/org/apache/servicecomb/toolkit/generator/util/ModelConverter.java [215:238]
public static List<Type> getResponseBeanTypes(Class cls) {
if (cls.isPrimitive()) {
return null;
}
Method[] declaredMethods = cls.getDeclaredMethods();
List<Type> beanPropertyTypes = new ArrayList<>();
for (Method method : declaredMethods) {
/**
* Meet the following requirements, can be considered a response bean property
* 1. method modifiers is public and non-static
* 2. method name should be getAbc or getABC, getabc is not a getter method
* 3. return value of method is not void
* 4. method has no parameters
*/
if (Modifier.isPublic(method.getModifiers()) && !Modifier.isStatic(method.getModifiers()) && method.getName()
.startsWith("get") && method.getName().length() > 3 && Character.isUpperCase(method.getName().charAt(3))
&& !method.getReturnType()
.equals(Void.TYPE) && method.getParameterCount() == 0) {
beanPropertyTypes.add(method.getGenericReturnType());
}
}
return beanPropertyTypes;
}