private Type getType(MemberDoc member) { if (member instanceof FieldDoc) { return ((FieldDoc) member).type(); } else { return ((MethodDoc) member).returnType(); } } }
/** * {@inheritDoc} */ protected void addSummaryType(ProgramElementDoc member, Content tdSummaryType) { FieldDoc field = (FieldDoc)member; addModifierAndType(field, field.type(), tdSummaryType); }
protected void printSummaryType(ProgramElementDoc member) { FieldDoc field = (FieldDoc)member; printModifierAndType(field, field.type()); }
private Type getType(MemberDoc member) { if (member instanceof FieldDoc) { return ((FieldDoc) member).type(); } else { return ((MethodDoc) member).returnType(); } } }
protected String typeString(MemberDoc member) { String type = ""; if (member instanceof MethodDoc) { type = ((MethodDoc)member).returnType().toString(); } else if (member instanceof FieldDoc) { type = ((FieldDoc)member).type().toString(); } return type; }
private Type getType(MemberDoc member) { if (member instanceof FieldDoc) { return ((FieldDoc) member).type(); } else { return ((MethodDoc) member).returnType(); } } }
... private Content getValue(FieldDoc member) { Content valueContent; if ("char".equals(member.type().toString())) { valueContent = new StringContent("'" + (char) ((Integer) member.constantValue()).intValue() + "'" ); } else { valueContent = new StringContent(member.constantValueExpression()); } Content code = HtmlTree.CODE(valueContent); return HtmlTree.TD(HtmlStyle.colLast, code); } ...
/** * 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); } }
private ParameterDescription getPublishedParameterDescription(ClassDescriptionSource source, FieldDoc fd, String name) { String currentClassName = fd.type().qualifiedTypeName(); while (true) { ClassDescription componentCD = source.getDescription(currentClassName); if (componentCD.classDoc == null) throw new IllegalArgumentException(String.format("Published parameter '%s' from %s not found.", name, fd.qualifiedName())); if (componentCD.parameters.containsKey(name)) { return componentCD.parameters.get(name); } currentClassName = componentCD.classDoc.superclass().typeName(); } }
private ParameterDescription getPublishedParameterDescription(ClassDescriptionSource source, FieldDoc fd, String name) { String currentClassName = fd.type().qualifiedTypeName(); while (true) { ClassDescription componentCD = source.getDescription(currentClassName); if (componentCD.classDoc == null) throw new IllegalArgumentException(String.format("Published parameter '%s' from %s not found.", name, fd.qualifiedName())); if (componentCD.parameters.containsKey(name)) { return componentCD.parameters.get(name); } currentClassName = componentCD.classDoc.superclass().typeName(); } }
protected String typeString(MemberDoc member) { String type = ""; if (member instanceof MethodDoc) { type = ((MethodDoc)member).returnType().toString(); } else if (member instanceof FieldDoc) { type = ((FieldDoc)member).type().toString(); } return type; }
private void writeTypeColumn(FieldDoc member) { tdAlign("right"); font("-1"); code(); StringTokenizer mods = new StringTokenizer(member.modifiers()); while(mods.hasMoreTokens()) { print(mods.nextToken() + " "); } printLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_CONSTANT_SUMMARY, member.type())); codeEnd(); fontEnd(); tdEnd(); }
/** 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); } }
/** 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); } }
private FieldRelationInfo getFieldRelationInfo(FieldDoc field) { Type type = field.type(); if(type.isPrimitive() || type instanceof WildcardType || type instanceof TypeVariable) return null; if (type.dimension().endsWith("[]")) { return new FieldRelationInfo(type.asClassDoc(), true); } Options opt = optionProvider.getOptionsFor(type.asClassDoc()); if (opt.matchesCollPackageExpression(type.qualifiedTypeName())) { Type[] argTypes = getInterfaceTypeArguments(collectionClassDoc, type); if (argTypes != null && argTypes.length == 1 && !argTypes[0].isPrimitive()) return new FieldRelationInfo(argTypes[0].asClassDoc(), true); argTypes = getInterfaceTypeArguments(mapClassDoc, type); if (argTypes != null && argTypes.length == 2 && !argTypes[1].isPrimitive()) return new FieldRelationInfo(argTypes[1].asClassDoc(), true); } return new FieldRelationInfo(type.asClassDoc(), false); }
private FieldRelationInfo getFieldRelationInfo(FieldDoc field) { Type type = field.type(); if(type.isPrimitive() || type instanceof WildcardType || type instanceof TypeVariable) return null; if (type.dimension().endsWith("[]")) { return new FieldRelationInfo(type.asClassDoc(), true); } Options opt = optionProvider.getOptionsFor(type.asClassDoc()); if (opt.matchesCollPackageExpression(type.qualifiedTypeName())) { Type[] argTypes = getInterfaceTypeArguments(collectionClassDoc, type); if (argTypes != null && argTypes.length == 1 && !argTypes[0].isPrimitive()) return new FieldRelationInfo(argTypes[0].asClassDoc(), true); argTypes = getInterfaceTypeArguments(mapClassDoc, type); if (argTypes != null && argTypes.length == 2 && !argTypes[1].isPrimitive()) return new FieldRelationInfo(argTypes[1].asClassDoc(), true); } return new FieldRelationInfo(type.asClassDoc(), false); }
/** * {@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; }
/** * {@inheritDoc} */ public void writeSignature(FieldDoc enumConstant) { writer.pre(); writer.writeAnnotationInfo(enumConstant); printModifiers(enumConstant); writer.printLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_MEMBER, enumConstant.type())); print(' '); if (configuration().linksource) { writer.printSrcLink(enumConstant, enumConstant.name()); } else { strong(enumConstant.name()); } writer.preEnd(); assert !writer.getMemberDetailsListPrinted(); }
/** * Write the signature for the given field. * * @param field the field being documented. */ public void writeSignature(FieldDoc field) { writer.pre(); writer.writeAnnotationInfo(field); printModifiers(field); writer.printLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_MEMBER, field.type())); print(' '); if (configuration().linksource) { writer.printSrcLink(field, field.name()); } else { strong(field.name()); } writer.preEnd(); assert !writer.getMemberDetailsListPrinted(); }