Argument id = null;
for (Field responseField : responseFields) {
SerializedName nameAnnotation = responseField.getAnnotation(SerializedName.class);
if (nameAnnotation != null) {
Param paramAnnotation = responseField.getAnnotation(Param.class);
Argument respArg = new Argument(nameAnnotation.value());
boolean hasChildren = false;
if (paramAnnotation != null && paramAnnotation.includeInApiDoc()) {
String description = paramAnnotation.description();
Class fieldClass = paramAnnotation.responseObject();
if (description != null && !description.isEmpty()) {
respArg.setDescription(description);
}
if(!paramAnnotation.since().isEmpty()){
respArg.setSinceVersion(paramAnnotation.since());
}
if (fieldClass != null) {
Class<?> superClass = fieldClass.getSuperclass();
if (superClass != null) {
String superName = superClass.getName();
if (superName.equals(BaseResponse.class.getName())) {
ArrayList<Argument> fieldArguments = new ArrayList<Argument>();
Field[] fields = fieldClass.getDeclaredFields();
fieldArguments = setResponseFields(fields, fieldClass);
respArg.setArguments(fieldArguments);
hasChildren = true;
}
}
}
}
if (paramAnnotation != null && paramAnnotation.includeInApiDoc()) {
if (nameAnnotation.value().equals("id")) {
id = respArg;
} else {
if (hasChildren) {
respArg.setName(nameAnnotation.value() + "(*)");