Search in sources :

Example 1 with FieldParameterBuilder

use of com.iggroup.oss.restdoclet.doclet.type.builder.FieldParameterBuilder in project RESTdoclet by IG-Group.

the class DocletUtils method getPublicFields.

/**
    * Return a list of all fields that have a public getter
    * 
    * @param classDoc class documentation
    * @return list of all fields that have a public getter
    */
public static Collection<FieldParameter> getPublicFields(final ClassDoc classDoc) {
    ArrayList<FieldParameter> fields = new ArrayList<FieldParameter>();
    MethodDoc[] methods = classDoc.methods();
    for (FieldDoc fieldDoc : classDoc.fields(false)) {
        boolean found = false;
        for (MethodDoc md : methods) {
            if (md.name().equalsIgnoreCase(GETTER_PREFIX + fieldDoc.name())) {
                found = true;
            }
        }
        if (found) {
            fields.add(new FieldParameterBuilder().build(new FieldParameter(), fieldDoc));
        }
    }
    return fields;
}
Also used : FieldParameterBuilder(com.iggroup.oss.restdoclet.doclet.type.builder.FieldParameterBuilder) FieldDoc(com.sun.javadoc.FieldDoc) MethodDoc(com.sun.javadoc.MethodDoc) ArrayList(java.util.ArrayList) FieldParameter(com.iggroup.oss.restdoclet.doclet.type.FieldParameter)

Aggregations

FieldParameter (com.iggroup.oss.restdoclet.doclet.type.FieldParameter)1 FieldParameterBuilder (com.iggroup.oss.restdoclet.doclet.type.builder.FieldParameterBuilder)1 FieldDoc (com.sun.javadoc.FieldDoc)1 MethodDoc (com.sun.javadoc.MethodDoc)1 ArrayList (java.util.ArrayList)1