return model;
}
protected void findClassProperties(RoundEnvironment roundEnv, Set<EndpointOption> endpointOptions, TypeElement classElement, String prefix) {
Elements elementUtils = processingEnv.getElementUtils();
while (true) {
List<VariableElement> fieldElements = ElementFilter.fieldsIn(classElement.getEnclosedElements());
if (fieldElements.isEmpty()) {
break;
}
for (VariableElement fieldElement : fieldElements) {
UriParam param = fieldElement.getAnnotation(UriParam.class);
String fieldName = fieldElement.getSimpleName().toString();
if (param != null) {
String name = param.name();
if (isNullOrEmpty(name)) {
name = fieldName;
}
name = prefix + name;
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;
}
}