public static Field getFieldByDoc(ClassDoc classDoc, FieldDoc fieldDoc) throws Exception { Class<?> classz = Class.forName(classDoc.qualifiedTypeName()); return classz.getDeclaredField(fieldDoc.name()); }
private FieldDoc fieldForProperty(FieldDoc[] fields, MethodDoc property) { for (FieldDoc field : fields) { final String fieldName = field.name(); final String propertyName = fieldName + "Property"; if (propertyName.equals(property.name())) { return field; } } return null; }
private void addField(FieldDoc fieldDoc) { this.fields.put(fieldDoc.name(), FieldDocumentation.fromFieldDoc(fieldDoc)); }
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; }
public void writeFieldAnnotiations(FieldDoc fieldDoc, StringBuilder sb) { AnnotationDesc[] annotations = fieldDoc.annotations(); for (AnnotationDesc annotation : annotations) { String fieldName = fieldDoc.name(); sb.append("\t").append(annotation.annotationType().name()).append(String.format(" [%s]", fieldName)); sb.append(" : \n"); writeAnnotationTable(annotation, sb); } }
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); } }
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); } }
/** * Get the name column for the constant summary table row. * * @param member the field to be documented. * @return the name column of the constant table row */ private Content getNameColumn(FieldDoc member) { Content nameContent = getDocLink( LinkInfoImpl.Kind.CONSTANT_SUMMARY, member, member.name(), false); Content code = HtmlTree.CODE(nameContent); return HtmlTree.TD(code); }
/** * {@inheritDoc} */ public Content getEnumConstantsTreeHeader(FieldDoc enumConstant, Content enumConstantsDetailsTree) { enumConstantsDetailsTree.addContent( writer.getMarkerAnchor(enumConstant.name())); Content enumConstantsTree = writer.getMemberTreeHeader(); Content heading = new HtmlTree(HtmlConstants.MEMBER_HEADING); heading.addContent(enumConstant.name()); enumConstantsTree.addContent(heading); return enumConstantsTree; }
/** * {@inheritDoc} */ public Content getFieldDocTreeHeader(FieldDoc field, Content fieldDetailsTree) { fieldDetailsTree.addContent( writer.getMarkerAnchor(field.name())); Content fieldDocTree = writer.getMemberTreeHeader(); Content heading = new HtmlTree(HtmlConstants.MEMBER_HEADING); heading.addContent(field.name()); fieldDocTree.addContent(heading); return fieldDocTree; }
/** * Build the serial UID information for the given class. */ public void buildSerialUIDInfo() { FieldDoc[] fields = currentClass.fields(false); for (int i = 0; i < fields.length; i++) { if (fields[i].name().equals("serialVersionUID") && fields[i].constantValueExpression() != null) { writer.writeSerialUIDInfo(SERIAL_VERSION_UID_HEADER, fields[i].constantValueExpression()); return; } } }
/** * Write the field header for the given field. * * @param field the field being documented. * @param isFirst the flag to indicate whether or not the field is the * first to be documented. */ public void writeFieldHeader(FieldDoc field, boolean isFirst) { if (! isFirst) { writer.printMemberHeader(); writer.println(""); } writer.anchor(field.name()); writer.h3(); writer.print(field.name()); writer.h3End(); }
private void writeNameColumn(FieldDoc member) { tdAlign("left"); code(); printDocLink(LinkInfoImpl.CONTEXT_CONSTANT_SUMMARY, member, member.name(), false); codeEnd(); tdEnd(); }
/** * {@inheritDoc} */ public Content getSignature(FieldDoc field) { Content pre = new HtmlTree(HtmlTag.PRE); writer.addAnnotationInfo(field, pre); addModifiers(field, pre); Content fieldlink = writer.getLink(new LinkInfoImpl( configuration, LinkInfoImpl.Kind.MEMBER, field.type())); pre.addContent(fieldlink); pre.addContent(" "); if (configuration.linksource) { Content fieldName = new StringContent(field.name()); writer.addSrcLink(field, fieldName, pre); } else { addName(field.name(), pre); } return pre; }
/** Print the class's attributes fd */ private void attributes(Options opt, FieldDoc fd[]) { for (FieldDoc f : fd) { if (hidden(f)) continue; stereotype(opt, f, Align.LEFT); String att = visibility(opt, f) + f.name(); if (opt.showType) att += typeAnnotation(opt, f.type()); tableLine(Align.LEFT, att); tagvalue(opt, f); } }
private void writeConstantMember(FieldDoc member) { trBgcolorStyle("white", "TableRowColor"); anchor(currentClassDoc.qualifiedName() + "." + member.name()); writeTypeColumn(member); writeNameColumn(member); writeValue(member); trEnd(); }
/** Print the class's attributes fd */ private void attributes(Options opt, FieldDoc fd[]) { for (FieldDoc f : fd) { if (hidden(f)) continue; String att = ""; stereotype(opt, f, Align.LEFT); att = visibility(opt, f) + f.name(); if (opt.showType) att += typeAnnotation(opt, f.type()); tableLine(Align.LEFT, att); tagvalue(opt, f); } }
/** * Build the field sub header. */ public void buildFieldSubHeader() { if (! currentClass.definesSerializableFields() ){ FieldDoc field = (FieldDoc) currentMember; fieldWriter.writeMemberHeader(field.type().asClassDoc(), field.type().typeName(), field.type().dimension(), field.name()); } }
/** * Build the field sub header. * * @param node the XML element that specifies which components to document * @param fieldsContentTree content tree to which the documentation will be added */ public void buildFieldSubHeader(XMLNode node, Content fieldsContentTree) { if (!currentClass.definesSerializableFields()) { FieldDoc field = (FieldDoc) currentMember; fieldWriter.addMemberHeader(field.type().asClassDoc(), field.type().typeName(), field.type().dimension(), field.name(), fieldsContentTree); } }