in oas-generator/oas-generator-core/src/main/java/org/apache/servicecomb/toolkit/generator/util/ModelConverter.java [189:213]
public static List<Type> getRequestBeanTypes(Class cls) {
if (cls.isPrimitive()) {
return null;
}
Method[] declaredMethods = cls.getDeclaredMethods();
List<Type> beanProperties = new ArrayList<>();
for (Method method : declaredMethods) {
/**
* Meet the following requirements, can be considered a request bean property
* 1. method modifiers is public and non-static
* 2. method name should be setAbc or setABC, setabc is not a setter method
* 3. return value of method is void
* 4. method has only one parameter
*/
if (Modifier.isPublic(method.getModifiers()) && !Modifier.isStatic(method.getModifiers()) && method.getName()
.startsWith("set") && method.getName().length() > 3 && Character.isUpperCase(method.getName().charAt(3))
&& method.getReturnType()
.equals(Void.TYPE) && method.getParameterCount() == 1) {
beanProperties.add(method.getGenericParameterTypes()[0]);
}
}
return beanProperties;
}