String defaultValue = param.defaultValue();
String defaultValueNote = param.defaultValueNote();
// if the field type is a nested parameter then iterate through its fields
TypeMirror fieldType = fieldElement.asType();
String fieldTypeName = fieldType.toString();
TypeElement fieldTypeElement = findTypeElement(roundEnv, fieldTypeName);
UriParams fieldParams = null;
if (fieldTypeElement != null) {
fieldParams = fieldTypeElement.getAnnotation(UriParams.class);
}
if (fieldParams != null) {
String nestedPrefix = prefix;
String extraPrefix = fieldParams.prefix();
if (!isNullOrEmpty(extraPrefix)) {
nestedPrefix += extraPrefix;
}
findClassProperties(roundEnv, endpointOptions, fieldTypeElement, nestedPrefix);
} else {
String docComment = elementUtils.getDocComment(fieldElement);
if (isNullOrEmpty(docComment)) {
String setter = "set" + fieldName.substring(0, 1).toUpperCase();
if (fieldName.length() > 1) {
setter += fieldName.substring(1);
}
// lets find the setter
List<ExecutableElement> methods = ElementFilter.methodsIn(classElement.getEnclosedElements());
for (ExecutableElement method : methods) {
String methodName = method.getSimpleName().toString();
if (setter.equals(methodName) && method.getParameters().size() == 1) {
String doc = elementUtils.getDocComment(method);
if (!isNullOrEmpty(doc)) {
docComment = doc;
break;
}
}
}
}
if (docComment == null) {
docComment = "";
}
// gather enums
Set<String> enums = new LinkedHashSet<>();
boolean isEnum = fieldTypeElement != null && fieldTypeElement.getKind() == ElementKind.ENUM;
if (isEnum) {
TypeElement enumClass = findTypeElement(roundEnv, fieldTypeElement.asType().toString());
// find all the enum constants which has the possible enum value that can be used
List<VariableElement> fields = ElementFilter.fieldsIn(enumClass.getEnclosedElements());
for (VariableElement var : fields) {
if (var.getKind() == ElementKind.ENUM_CONSTANT) {
String val = var.toString();
enums.add(val);
}
}
}
EndpointOption option = new EndpointOption(name, fieldTypeName, defaultValue, defaultValueNote, docComment.trim(), isEnum, enums);
endpointOptions.add(option);
}
}
}
TypeElement baseTypeElement = null;
TypeMirror superclass = classElement.getSuperclass();
if (superclass != null) {
String superClassName = canonicalClassName(superclass.toString());
baseTypeElement = findTypeElement(roundEnv, superClassName);
}
if (baseTypeElement != null) {
classElement = baseTypeElement;
} else {