if (Strings.isNullOrEmpty(name)) {
name = fieldName;
}
name = prefix + name;
// 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 (!Strings.isNullOrEmpty(extraPrefix)) {
nestedPrefix += extraPrefix;
}
findClassProperties(roundEnv, sortedMap, fieldTypeElement, nestedPrefix);
} else {
String docComment = elementUtils.getDocComment(fieldElement);
if (Strings.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 (!Strings.isNullOrEmpty(doc)) {
docComment = doc;
break;
}
}
}
}
if (docComment == null) {
docComment = "";
}
List<String> values = new ArrayList<String>();
values.add(" <td>" + fieldTypeName + "</td>");
values.add(" <td>" + docComment.trim() + "</td>");
// TODO would be nice here to create a default endpoint/consumer object
// and return the default value of the field so we can put it into the docs
Object defaultValue = null;
if (defaultValue != null) {
values.add(" <td>" + defaultValue + "</td>");
}
if (sortedMap.containsKey(name)) {
error("Duplicate parameter annotation named '" + name + "' on class " + classElement.getQualifiedName());
} else {
sortedMap.put(name, values);
}
}
}
}
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 {