/** * Check to see if overview details should be printed. If * nocomment option set or if there is no text to be printed * for deprecation info, comment or tags, do not print overview details. * * @param field the field to check overview details for. * @return true if overview details need to be printed */ public boolean shouldPrintOverview(FieldDoc field) { if (!configuration.nocomment) { if(!field.commentText().isEmpty() || writer.hasSerializationOverviewTags(field)) return true; } if (field.tags("deprecated").length > 0) return true; return false; } }
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; }
/** * Check to see if overview details should be printed. If * nocomment option set or if there is no text to be printed * for deprecation info, comment or tags, do not print overview details. * * @param field the field to check overview details for. * @return true if overview details need to be printed */ public boolean shouldPrintOverview(FieldDoc field) { if (!configuration().nocomment) { if(!field.commentText().isEmpty() || writer.hasSerializationOverviewTags(field)) return true; } if (field.tags("deprecated").length > 0) return true; return false; }
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<>(field.constantValue().toString(), row); }
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; }
/** * Add the description text for this member. * * @param field the field to document. * @param contentTree the tree to which the deprecated info will be added */ public void addMemberDescription(FieldDoc field, Content contentTree) { if (field.inlineTags().length > 0) { writer.addInlineComment(field, contentTree); } Tag[] tags = field.tags("serial"); if (tags.length > 0) { writer.addInlineComment(field, tags[0], contentTree); } }
/** * Parses an enum type definition * * @param fieldDoc * @return */ protected EnumConstant parseEnumConstant(FieldDoc fieldDoc) { EnumConstant enumConstant = objectFactory.createEnumConstant(); enumConstant.setName(fieldDoc.name()); String comment = fieldDoc.commentText(); if (comment.length() > 0) { enumConstant.setComment(comment); } for (AnnotationDesc annotationDesc : fieldDoc.annotations()) { enumConstant.getAnnotation().add(parseAnnotationDesc(annotationDesc, fieldDoc.qualifiedName())); } for (Tag tag : fieldDoc.tags()) { enumConstant.getTag().add(parseTag(tag)); } return enumConstant; }
/** * Build the field information. * * @param node the XML element that specifies which components to document * @param fieldsContentTree content tree to which the documentation will be added */ public void buildFieldInfo(XMLNode node, Content fieldsContentTree) { if(configuration.nocomment){ return; } FieldDoc field = (FieldDoc)currentMember; ClassDoc cd = field.containingClass(); // Process default Serializable field. if ((field.tags("serial").length == 0) && ! field.isSynthetic() && configuration.serialwarn) { configuration.message.warning(field.position(), "doclet.MissingSerialTag", cd.qualifiedName(), field.name()); } fieldWriter.addMemberDescription(field, fieldsContentTree); fieldWriter.addMemberTags(field, fieldsContentTree); }
/** * Write the description text for this member. * * @param field the field to document. */ public void writeMemberDescription(FieldDoc field) { if (field.inlineTags().length > 0) { writer.printMemberDetailsListStartTag(); writer.dd(); writer.printInlineComment(field); writer.ddEnd(); } Tag[] tags = field.tags("serial"); if (tags.length > 0) { writer.printMemberDetailsListStartTag(); writer.dd(); writer.printInlineComment(field, tags[0]); writer.ddEnd(); } }
if ((field.tags("serial").length == 0) && ! field.isSynthetic() && configuration.serialwarn) { configuration.message.warning(field.position(),
protected Field parseField(FieldDoc fieldDoc) { Field fieldNode = objectFactory.createField(); fieldNode.setType(parseTypeInfo(fieldDoc.type())); fieldNode.setName(fieldDoc.name()); fieldNode.setQualified(fieldDoc.qualifiedName()); String comment = fieldDoc.commentText(); if (comment.length() > 0) { fieldNode.setComment(comment); } fieldNode.setScope(parseScope(fieldDoc)); fieldNode.setFinal(fieldDoc.isFinal()); fieldNode.setStatic(fieldDoc.isStatic()); fieldNode.setVolatile(fieldDoc.isVolatile()); fieldNode.setTransient(fieldDoc.isTransient()); fieldNode.setConstant(fieldDoc.constantValueExpression()); for (AnnotationDesc annotationDesc : fieldDoc.annotations()) { fieldNode.getAnnotation().add(parseAnnotationDesc(annotationDesc, fieldDoc.qualifiedName())); } for (Tag tag : fieldDoc.tags()) { fieldNode.getTag().add(parseTag(tag)); } return fieldNode; }