Java 类com.sun.javadoc.FieldDoc 实例源码

项目:PrivacyStreams    文件:PSItemDoc.java   
private PSItemDoc(ClassDoc classDoc) {
    this.classDoc = classDoc;
    this.name = classDoc.name();
    this.description = classDoc.commentText();
    this.itemFieldDocs = new ArrayList<>();
    this.providerDocs = new ArrayList<>();

    List<FieldDoc> allFields = new ArrayList<>();
    this.getAllFieldDocs(classDoc, allFields);

    for (FieldDoc fieldDoc : allFields) {
        PSItemFieldDoc itemFieldDoc = PSItemFieldDoc.build(this, fieldDoc);
        if (itemFieldDoc != null) this.itemFieldDocs.add(itemFieldDoc);
    }

    for (MethodDoc methodDoc : classDoc.methods()) {
        PSOperatorDoc providerDoc = PSOperatorDoc.build(classDoc, methodDoc);
        if (providerDoc != null) this.providerDocs.add(providerDoc);
    }
}
项目:ThriftyPaxos    文件:Doclet.java   
private void writeFieldDetails(PrintWriter writer, ClassDoc clazz,
        FieldDoc field) {
    if (skipField(clazz, field)) {
        return;
    }
    String text = field.commentText();
    if (text.startsWith("INTERNAL")) {
        return;
    }
    String name = field.name();
    String constant = field.constantValueExpression();
    String link = getFieldLink(text, constant, clazz, name);
    writer.println("<h4 id=\"" + link + "\"><span class=\"methodName\">" +
            name);
    if (constant == null) {
        writer.println();
    } else {
        writer.println(" = " + constant);
    }
    writer.println("</span></h4>");
    writer.println("<div class=\"item\">" + formatText(text) + "</div>");
    writer.println("<hr />");
}
项目:barclay    文件:DefaultDocWorkUnitHandler.java   
/**
 * Helper routine that provides a FreeMarker map for an enumClass, grabbing the
 * values of the enum and their associated javadoc documentation.
 *
 * @param enumClass
 * @return
 */
private List<Map<String, Object>> docForEnumArgument(final Class<?> enumClass) {
    final ClassDoc doc = this.getDoclet().getClassDocForClass(enumClass);
    if ( doc == null ) {
        throw new RuntimeException("Tried to get docs for enum " + enumClass + " but got null instead");
    }

    final Set<String> enumConstantFieldNames = enumConstantsNames(enumClass);
    final List<Map<String, Object>> bindings = new ArrayList<Map<String, Object>>();
    for (final FieldDoc fieldDoc : doc.fields(false)) {
        if (enumConstantFieldNames.contains(fieldDoc.name()) ) {
            bindings.add(
                    new HashMap<String, Object>() {
                        static final long serialVersionUID = 0L;
                        {
                            put("name", fieldDoc.name());
                            put("summary", fieldDoc.commentText());
                        }
                    }
            );
        }
    }

    return bindings;
}
项目:msgcodec    文件:GroupDefDoc.java   
public GroupDefDoc(ClassDoc doc) {
    this.classDoc = doc;
    this.name = DocAnnotationDoclet.getNameAnnotation(classDoc.annotations(), classDoc.simpleTypeName());
    this.className = classDoc.qualifiedName();

    // fields
    fields = new ArrayList<>();
    for (FieldDoc field : getFields(classDoc)) {
        if (field.isStatic()) {
            continue;
        }
        String fieldName = DocAnnotationDoclet.getNameAnnotation(field.annotations(), field.name());

        fields.add(new FieldDefDoc(fieldName, field));
    }

}
项目:baleen    文件:BaleenJavadoc.java   
protected static String processExternalResources(ClassDoc classDoc){
    StringBuilder cpText = new StringBuilder("<dt><b>Configuration Parameters:</b></dt><dd><table><tr style=\"text-align: left\"><th>Parameter</th><th>Description</th><th>Default Value(s)</th></tr>");
    Map<String, String> rows = new TreeMap<>();

    for(FieldDoc field : getFields(classDoc)){
        Entry<String, String> entry = createParameterRow(field);
        if(entry != null){
            rows.put(entry.getKey(), entry.getValue());
        }
    }

    if(rows.isEmpty()){
        cpText.setLength(0);
    }else{
        for(String s : rows.values()){
            cpText.append(s);
        }
    }

    cpText.append("</table></dd>");
    return cpText.toString();
}
项目:baleen    文件:BaleenJavadoc.java   
protected static String processConfigurationParameters(ClassDoc classDoc){
    StringBuilder erText = new StringBuilder("<dt><b>External Resources:</b></dt><dd><ul>");

    List<String> resources = new ArrayList<>();
    for(FieldDoc field : getFields(classDoc)){
        resources.addAll(createResourceItem(field));
    }

    if(resources.isEmpty()){
        return null;
    }else{
        for(String s : resources){
            erText.append(wrapWithTag("li", s, null));
        }
    }

    erText.append("</ul></dd>");
    return erText.toString();
}
项目:baleen    文件:BaleenJavadoc.java   
private static Entry<String, String> createParameterRow(FieldDoc field){
    Tag[] tags = field.tags("@"+ConfigurationParameters.NAME);
    if(tags.length == 0){
        return null;
    }

    String name = wrapWithTag("td", field.constantValue(), "padding-right: 20px");
    String desc = wrapWithTag("td", field.commentText(), "padding-right: 20px");

    StringBuilder defaultValues = new StringBuilder("");
    for(Tag tag : tags){
        defaultValues.append(tag.text());
        defaultValues.append("<br />");
    }
    String values = wrapWithTag("td", defaultValues.toString(), null);

    String row = wrapWithTag("tr", name + desc + values, null);

    return new AbstractMap.SimpleEntry<String, String>(field.constantValue().toString(), row);
}
项目:baleen    文件:BaleenJavadoc.java   
private static List<String> createResourceItem(FieldDoc field){
    Tag[] tags = field.tags("@"+ExternalResources.NAME);
    if(tags.length == 0){
        return Collections.emptyList();
    }

    List<String> ret = new ArrayList<>();

    String pkg = field.containingPackage().name();
    int levels = pkg.length() - pkg.replaceAll("\\.", "").length() + 1;

    StringBuilder linkLevels = new StringBuilder("");
    for(int i = 0; i < levels; i++){
        linkLevels.append("../");
    }

    for(Tag tag : tags){
        ret.add("<a href=\""+linkLevels.toString()+tag.text().replaceAll("\\.", "/")+".html\">" + tag.text() + "</a> (key = " + field.constantValue() + ")");
    }

    return ret;
}
项目:xml-doclet    文件:Parser.java   
private String parseIdentifier(Doc doc) {
  if (doc instanceof ClassDoc) {
    ClassDoc classDoc = (ClassDoc) doc;

    return parseIdentifier((Doc) classDoc.containingPackage()) + classDoc.name() + "/";
  } else if (doc instanceof AnnotationTypeElementDoc) {
    AnnotationTypeElementDoc annotationTypeElementDoc = (AnnotationTypeElementDoc) doc;
    return parseIdentifier((Doc) annotationTypeElementDoc.containingClass()) + "#" + annotationTypeElementDoc.name();
  } else if (doc instanceof FieldDoc) {
    FieldDoc fieldDoc = (FieldDoc) doc;
    return parseIdentifier((Doc) fieldDoc.containingClass()) + "#" + fieldDoc.name();
  } else if (doc instanceof ConstructorDoc) {
    ConstructorDoc constructorDoc = (ConstructorDoc) doc;
    return parseIdentifier((Doc) constructorDoc.containingClass()) + "#" + constructorDoc.name() + URLEncoder.encode(constructorDoc.flatSignature());
  } else if (doc instanceof MethodDoc) {
    MethodDoc methodDoc = (MethodDoc) doc;
    return parseIdentifier((Doc) methodDoc.containingClass()) + "#" + methodDoc.name() + URLEncoder.encode(methodDoc.flatSignature());
  } else {
    return "/" + doc.name() + "/";
  }
}
项目:marklet    文件:ClassPageBuilder.java   
/**
 * Appends to the current document the
 * field summary if any field is exposed.
 */
private void fieldsSummary() {
    if (hasField()) {
        header(4);
        text(MarkletConstant.FIELDS);
        newLine();
        tableHeader(MarkletConstant.FIELDS_SUMMARY_HEADERS);
        getOrderedElements(classDoc::fields)
            .filter(FieldDoc::isStatic)
            .forEach(this::rowSignature);
        getOrderedElements(classDoc::fields)
            .filter(field -> !field.isStatic())
            .forEach(this::rowSignature);
        newLine();
    }
}
项目:conqat    文件:JavaDocAnalyzer.java   
/** Analyze fields. */
private void analyzeFields(ClassDoc classDoc, IJavaElement element)
        throws ConQATException {
    for (FieldDoc fieldDoc : classDoc.fields()) {
        for (int i = 0; i < fieldAnalyzers.size(); i++) {
            IFieldDocAnalyzer analyzer = fieldAnalyzers.getFirst(i);

            Modifiers actualModifiers = new Modifiers(
                    fieldDoc.modifierSpecifier(), false);
            Modifiers requiredModifiers = fieldAnalyzers.getSecond(i);
            if (requiredModifiers.isSatisfied(actualModifiers)) {
                analyzer.analyze(fieldDoc, element);
            }
        }
    }
}
项目:conqat    文件:ConQATTaglet.java   
/**
 * Checks the type of the program element and determines comment
 * accordingly.
 */
@Override
public TagletOutput getTagletOutput(Tag tag, TagletWriter writer) {

    Doc doc = tag.holder();

    String text;
    if (doc instanceof MethodDoc) {
        text = methodDoc((MethodDoc) doc);
    } else if (doc instanceof ClassDoc) {
        text = classDoc((ClassDoc) doc);
    } else if (doc instanceof FieldDoc) {
        text = fieldDoc((FieldDoc) doc);
    } else {
        throw new IllegalStateException("Should not happen.");
    }

    if (isFirstSentence(writer)) {
        text = getFirstSentence(text);
    }

    TagletOutput result = writer.getOutputInstance();
    result.setOutput(text);
    return result;
}
项目:javadoc-json-doclet    文件:JsonDoclet.java   
/**
 * @return the full JSON for the given FieldDoc
 */
protected JSONObject processFieldDoc(FieldDoc fieldDoc) {

    if (fieldDoc == null) {
        return null;
    }

    JSONObject retMe = processMemberDoc(fieldDoc);

    retMe.put("type", processType(fieldDoc.type()));
    retMe.put("constantValueExpression", fieldDoc.constantValueExpression());
    retMe.put("constantValue", ((fieldDoc.constantValue() != null) ? fieldDoc.constantValue().toString() : null));
    retMe.put("serialFieldTags", processTags(fieldDoc.serialFieldTags()));

    return retMe;
}
项目:javaontracks    文件:JOTDocletNavView.java   
public Vector getEnumConstants()
{
    Vector myDocs = new Vector();
    ClassDoc mainDoc = (ClassDoc) getVariables().get("curitem");
    FieldDoc[] docs = mainDoc.enumConstants();
    ClassDoc doc = mainDoc.superclass();
    for (int i = 0; i != docs.length; i++)
    {
        myDocs.add(docs[i]);
    }
    // go through all superclasses fields
    while (doc != null && !doc.name().equalsIgnoreCase("object"))
    {
        //note: We don't add the "object" fields (clutter)
        docs = doc.enumConstants();
        for (int i = 0; i != docs.length; i++)
        {
            myDocs.add(docs[i]);
        }
        doc = doc.superclass();
    }
    FieldDoc[] docArray = (FieldDoc[]) myDocs.toArray(new FieldDoc[0]);
    Arrays.sort(docArray);
    return myDocs;

}
项目:javaontracks    文件:JOTDocletNavView.java   
public String getReturnString(JOTDocletHolder holder)
{
    Type type = null;
    if (holder instanceof JOTDocletFieldHolder)
    {
        type = ((FieldDoc) holder.getDoc()).type();
    } else
    {
        type = ((MethodDoc) holder.getDoc()).returnType();
    }
    String str = "";
    if (type.asParameterizedType() != null)
    {
        str += handleGenerics(type, 0);
    } else if (type.asTypeVariable() != null)
    {
        str += handleGenerics(type, 0);
    } else if (type.asClassDoc() != null)
    {
        str += getTypeLink(type.asClassDoc());
    } else
    {
        str += "<font class='type'>" + type.simpleTypeName() + "</font>";
    }
    return str;
}
项目:qtaste    文件:HTMLFileWriter.java   
/**
 * Prints Test API Component header.
 *
 * @param classDoc the ClassDoc specifying the class
 * @param root the RootDoc passed to the doclet
 */
public void printTestAPIComponentHeader(ClassDoc classDoc, RootDoc root) {
    mOut.println("<H2>QTaste Test API Component Interface " + classDoc.name() + "</H2>");
    mOut.println(classDoc.commentText());

    // factory
    FieldDoc factoryField = TestAPIDoclet.getFactoryField(classDoc, root);
    if (factoryField != null) {
        mOut.println("<P>");
        mOut.println(factoryField.commentText());
    }

    // config tags
    Tag[] tags = classDoc.tags("@config");
    if (tags.length > 0) {
        mOut.println("<DL>");
        mOut.println("<DT><B>Configuration:</B></DT>");
        List<TestAPIDoclet.NameTypeDescription> configList = TestAPIDoclet.getNameTypeDescriptionList(tags);
        for (TestAPIDoclet.NameTypeDescription config : configList) {
            mOut.println("<DD><CODE>" + config.name + "</CODE> (<CODE>" + config.type + "</CODE>) - " + config.description
                  + "</DD>");
        }
        mOut.println("</DL>");
    }
}
项目:qtaste    文件:TestAPIDoclet.java   
/**
 * Returns the factory field doc of a Test API component interface.
 *
 * @param classDoc the ClassDoc specifying the Test API component interface
 * @param root the RootDoc passed to the doclet
 * @return the FieldDoc of the factory field inherited from extended interface
 * or null if no factory field found
 */
public static FieldDoc getFactoryField(ClassDoc classDoc, RootDoc root) {
    ClassDoc ComponentFactory = root.classNamed(TEST_API_KERNEL_PACKAGE + ".ComponentFactory");
    for (ClassDoc interface_ : classDoc.interfaces()) {
        if (isTestAPI(interface_, root)) {
            for (FieldDoc field : interface_.fields()) {
                if (field.name().equals("factory")) {
                    ClassDoc fieldClassDoc = field.type().asClassDoc();
                    if ((fieldClassDoc != null) && fieldClassDoc.subclassOf(ComponentFactory)) {
                        return field;
                    }
                }
            }
        }
    }
    return null;
}
项目:PrivacyStreams    文件:PSItemFieldDoc.java   
private PSItemFieldDoc(PSItemDoc psItemDoc, FieldDoc fieldDoc, AnnotationDesc annotation) {
    this.psItemDoc = psItemDoc;
    this.reference = fieldDoc.name();
    this.name = fieldDoc.constantValue().toString();
    this.description = fieldDoc.commentText().replace('\n', ' ');

    for (AnnotationDesc.ElementValuePair elementValuePair : annotation.elementValues()) {
        if ("type".equals(elementValuePair.element().name())) {
            Object typeValue = elementValuePair.value().value();
            this.type = (Type) typeValue;
        }
    }
}
项目:PrivacyStreams    文件:PSItemFieldDoc.java   
public static PSItemFieldDoc build(PSItemDoc psItemDoc, FieldDoc fieldDoc) {
    AnnotationDesc[] annotations = fieldDoc.annotations();
    for (AnnotationDesc annotation : annotations) {
        AnnotationTypeDoc annotationType = annotation.annotationType();
        if (Consts.ITEM_FIELD_ANNOTATION.equals(annotationType.toString())) {
            return new PSItemFieldDoc(psItemDoc, fieldDoc, annotation);
        }
    }
    return null;
}
项目:PrivacyStreams    文件:PSItemDoc.java   
private void getAllFieldDocs(ClassDoc classDoc, List<FieldDoc> fieldDocs) {
    if (classDoc.superclass() != null) {
        this.getAllFieldDocs(classDoc.superclass(), fieldDocs);
    }
    if (isValidPSItem(classDoc)) {
        fieldDocs.addAll(Arrays.asList(classDoc.fields()));
    }
}
项目:wrdocletbase    文件:AbstractDocBuilder.java   
protected String getFieldDescription(FieldDoc fieldDoc) {
    StringBuilder strBuilder = new StringBuilder();
    strBuilder.append(fieldDoc.commentText());
    strBuilder.append(" ");
    strBuilder.append(this.getFieldValidatorDesc(fieldDoc));
    return strBuilder.toString();
}
项目:wrdocletbase    文件:AbstractDocBuilder.java   
protected String getFieldValidatorDesc(FieldDoc fieldDoc) {
    StringBuilder strBuilder = new StringBuilder();
    for (AnnotationDesc annotationDesc : fieldDoc.annotations()) {
        if (annotationDesc.annotationType().qualifiedTypeName().startsWith("org.hibernate.validator.constraints")
                || annotationDesc.annotationType().qualifiedTypeName().startsWith("javax.validation.constraints")
                || annotationDesc.annotationType().qualifiedTypeName().startsWith("lombok.NonNull")) {
            strBuilder.append("@");
            strBuilder.append(annotationDesc.annotationType().name());
            if (annotationDesc.elementValues().length > 0) {
                strBuilder.append("(");
                boolean isFirstElement = true;
                for (AnnotationDesc.ElementValuePair elementValuePair : annotationDesc.elementValues()) {
                    if (!isFirstElement) {
                        strBuilder.append(",");
                    }
                    strBuilder.append(elementValuePair.element().name());
                    strBuilder.append("=");
                    strBuilder.append(
                            net.winroad.wrdoclet.utils.Util.decodeUnicode(elementValuePair.value().toString()));
                    isFirstElement = false;
                }
                strBuilder.append(")");
            }
            strBuilder.append(" ");
        }
    }
    return strBuilder.toString();
}
项目:openjdk-jdk10    文件:T8147801.java   
void dump(PrintWriter out, String prefix, ClassDoc cd) {
    out.println(prefix + "class: " + cd);
    for (FieldDoc fd: cd.fields()) {
        out.println(prefix + "  " + fd);
        if (fd.type().asClassDoc() != null) {
            dump(out, prefix + "    ", fd.type().asClassDoc());
        }
    }
}
项目:openjdk9    文件:T8147801.java   
void dump(String prefix, ClassDoc cd) {
    System.err.println(prefix + "class: " + cd);
    for (FieldDoc fd: cd.fields()) {
        System.err.println(fd);
        if (fd.type().asClassDoc() != null) {
            dump(prefix + "  ", fd.type().asClassDoc());
        }
    }
}
项目:barclay    文件:DefaultDocWorkUnitHandler.java   
/**
 * Recursive helper routine to getFieldDoc()
 */
private FieldDoc getFieldDoc(final ClassDoc classDoc, final String argumentFieldName) {
    for (final FieldDoc fieldDoc : classDoc.fields(false)) {
        if (fieldDoc.name().equals(argumentFieldName)) {
            return fieldDoc;
        }

        // This can return null, specifically, we can encounter https://bugs.openjdk.java.net/browse/JDK-8033735,
        // which is fixed in JDK9 http://hg.openjdk.java.net/jdk9/jdk9/hotspot/rev/ba8c351b7096.
        final Field field = DocletUtils.getFieldForFieldDoc(fieldDoc);
        if (field == null) {
            logger.warn(
                String.format(
                    "Could not access the field definition for %s while searching for %s, presumably because the field is inaccessible",
                    fieldDoc.name(),
                        argumentFieldName)
            );
        } else if (field.isAnnotationPresent(ArgumentCollection.class)) {
            final ClassDoc typeDoc = getDoclet().getRootDoc().classNamed(fieldDoc.type().qualifiedTypeName());
            if (typeDoc == null) {
                throw new DocException("Tried to get javadocs for ArgumentCollection field " +
                        fieldDoc + " but couldn't find the class in the RootDoc");
            } else {
                FieldDoc result = getFieldDoc(typeDoc, argumentFieldName);
                if (result != null) {
                    return result;
                }
                // else keep searching
            }
        }
    }

    // if we didn't find it here, wander up to the superclass to find the field
    if (classDoc.superclass() != null) {
        return getFieldDoc(classDoc.superclass(), argumentFieldName);
    }

    return null;
}
项目:barclay    文件:DocletUtils.java   
protected static Field getFieldForFieldDoc(FieldDoc fieldDoc) {
    try {
        Class<?> clazz = getClassForDoc(fieldDoc.containingClass());
        return JVMUtils.findField(clazz, fieldDoc.name());
    } catch (ClassNotFoundException e) {
        throw new RuntimeException(e);
    }
}
项目:closure-maven-plugin    文件:PluginConfigDoclet.java   
ParameterInfo(
    String name, Optional<FieldDoc> field, Optional<MethodDoc> setter) {
  Preconditions.checkArgument(field.isPresent() || setter.isPresent());
  this.name = name;
  this.field = field;
  this.setter = setter;

  Preconditions.checkArgument(
      !this.setter.isPresent() || isSetter(this.setter.get()));
}
项目:javify    文件:AbstractDoclet.java   
protected FieldDoc[] getSortedFields(ClassDoc classDoc)
{
   FieldDoc[] result = (FieldDoc[])sortedFieldMap.get(classDoc);
   if (null == result) {
      FieldDoc[] fields = classDoc.fields();
      result = (FieldDoc[])fields.clone();
      Arrays.sort(result);
      return result;
   }
   return result;
}
项目:javify    文件:AbstractDoclet.java   
protected FieldDoc findField(ClassDoc classDoc, String fieldName)
{
   for (ClassDoc cd = classDoc; cd != null; cd = cd.superclass()) {
      FieldDoc[] fields = cd.fields(false);
      for (int i=0; i<fields.length; ++i) {
         if (fields[i].name().equals(fieldName)) {
            return fields[i];
         }
      }
   }
   return null;
}
项目:jvm-stm    文件:AbstractDoclet.java   
protected FieldDoc[] getSortedFields(ClassDoc classDoc)
{
   FieldDoc[] result = (FieldDoc[])sortedFieldMap.get(classDoc);
   if (null == result) {
      FieldDoc[] fields = classDoc.fields();
      result = (FieldDoc[])fields.clone();
      Arrays.sort(result);
      return result;
   }
   return result;
}
项目:jvm-stm    文件:AbstractDoclet.java   
protected FieldDoc findField(ClassDoc classDoc, String fieldName)
{
   for (ClassDoc cd = classDoc; cd != null; cd = cd.superclass()) {
      FieldDoc[] fields = cd.fields(false);
      for (int i=0; i<fields.length; ++i) {
         if (fields[i].name().equals(fieldName)) {
            return fields[i];
         }
      }
   }
   return null;
}
项目:xmldoclet    文件:XMLDoclet.java   
/**
 * Returns the specified field as an XML node.
 *
 * @param field A field.
 * @return The corresponding node.
 */
private static XMLNode toFieldNode(FieldDoc field) {
  // Create the <field> node and populate it.
  XMLNode node = new XMLNode("field");
  node.attribute("name", field.name());
  node.attribute("type", field.type().typeName());
  node.attribute("fulltype", field.type().toString());

  if (field.constantValue() != null && field.constantValue().toString().length() > 0) {
    node.attribute("const", field.constantValue().toString());
  }

  if (field.constantValueExpression() != null && field.constantValueExpression().length() > 0) {
    node.attribute("constexpr", field.constantValueExpression());
  }

  node.attribute("static", field.isStatic());
  node.attribute("final", field.isFinal());
  node.attribute("transient", field.isTransient());
  node.attribute("volatile", field.isVolatile());
  node.attribute("visibility", getVisibility(field));

  // Comment
  node.child(toComment(field));

  // Other child nodes
  node.child(toStandardTags(field));
  node.child(toTags(field));
  node.child(toSeeNodes(field.seeTags()));

  return node;
}
项目:xmldoclet    文件:XMLDoclet.java   
/**
 * Returns the fields node.
 *
 * @param fields The set of fields.
 * @return the fields or <code>null</code> if none.
 */
private static XMLNode toFieldsNode(FieldDoc[] fields) {
  if (fields.length < 1) return null;
  // Iterate over the fields
  XMLNode node = new XMLNode("fields");
  for (FieldDoc field : fields) {
    node.child(toFieldNode(field));
  }
  return node;
}
项目:xmldoclet    文件:XMLDoclet.java   
/**
 * Returns the value type of the annotation depending on the specified object's class.
 *
 * @param o the object representing the type of annotation value.
 * @return the primitive if any of full class name.
 */
private static String getAnnotationValueType(Object o) {
  if (o instanceof String)  return "String";
  if (o instanceof Integer) return "int";
  if (o instanceof Boolean) return "boolean";
  if (o instanceof Long)    return "long";
  if (o instanceof Short)   return "short";
  if (o instanceof Float)   return "float";
  if (o instanceof Double)  return "double";
  if (o instanceof FieldDoc) return ((FieldDoc)o).containingClass().qualifiedName();
  return o.getClass().getName();
}
项目:msgcodec    文件:GroupDefDoc.java   
private static void addFields(ClassDoc classDoc, Collection<FieldDoc> fields) {
    ClassDoc superClass = classDoc.superclass();
    if (superClass != null) {
        addFields(superClass, fields);
    }
    for (FieldDoc method : classDoc.fields()) {
        fields.add(method);
    }
}
项目:baleen    文件:AbstractBaleenTaglet.java   
/**
 * Return a list of fields for this class and all it's superclasses
 */
protected static List<FieldDoc> getFields(ClassDoc classDoc){
    List<FieldDoc> ret = new ArrayList<>();
    ClassDoc parent = classDoc.superclass();
    if(parent != null){
        ret.addAll(getFields(parent));
    }

    ret.addAll(Arrays.asList(classDoc.fields()));

    return ret;
}
项目:spring-auto-restdocs    文件:ClassDocumentation.java   
public static ClassDocumentation fromClassDoc(ClassDoc classDoc) {
    ClassDocumentation cd = new ClassDocumentation();
    cd.setComment(classDoc.commentText());
    for (FieldDoc fieldDoc : classDoc.fields(false)) {
        cd.addField(fieldDoc);
    }
    for (MethodDoc methodDoc : classDoc.methods(false)) {
        cd.addMethod(methodDoc);
    }
    return cd;
}
项目:spring-auto-restdocs    文件:FieldDocumentation.java   
public static FieldDocumentation fromFieldDoc(FieldDoc fieldDoc) {
    FieldDocumentation fd = new FieldDocumentation();
    fd.comment = fieldDoc.commentText();

    for (Tag tag : fieldDoc.tags()) {
        fd.tags.put(cleanupTagName(tag.name()), tag.text());
    }

    return fd;
}
项目:xml-doclet    文件:Parser.java   
/**
 * Parses an enum type definition
 * 
 * @param fieldDoc
 * @return
 */
protected EnumValue parseEnumValue(FieldDoc fieldDoc) {
  EnumValue enumValue = objectFactory.createEnumValue();
  enumValue.setName(fieldDoc.name());
  enumValue.setIdentifier(parseIdentifier((Doc) fieldDoc));
  enumValue.setId(fieldDoc.name());
  enumValue.setComment(parseComment(fieldDoc));

  Tag[] tags;
  SeeTag[] seeTags;

  tags = fieldDoc.tags("@deprecated");
  if (tags.length > 0) {
    enumValue.setDeprecated(parseComment(tags[0]));
  }

  tags = fieldDoc.tags("@since");
  if (tags.length > 0) {
    enumValue.setSince(tags[0].text());
  }

  tags = fieldDoc.tags("@version");
  if (tags.length > 0) {
    enumValue.setVersion(tags[0].text());
  }

  seeTags = fieldDoc.seeTags();
  for (int i = 0; i < seeTags.length; i++) {
    enumValue.getLink().add(parseLink(seeTags[i]));
  }

  return enumValue;
}
项目:api-resolver    文件:DocletUtil.java   
public static FieldDoc getFieldDoc(ClassDoc classDoc, String name) {
    for (FieldDoc fieldDoc : classDoc.fields()) {
        if (fieldDoc.name().equals(name) 
                ||name.equals(getAnnotationValue(fieldDoc, Param.class, "value"))) {
            return fieldDoc;
        } 
    }

    return null;
}