src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlSerialFieldWriter.java

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this --- 1,7 ---- /* ! * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this
*** 21,39 **** * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ ! package com.sun.tools.doclets.formats.html; import java.util.*; ! import com.sun.javadoc.*; ! import com.sun.tools.doclets.formats.html.markup.*; ! import com.sun.tools.doclets.internal.toolkit.*; ! import com.sun.tools.doclets.internal.toolkit.taglets.*; /** * Generate serialized form for serializable fields. * Documentation denoted by the tags <code>serial</code> and * <code>serialField</code> is processed. * --- 21,51 ---- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ ! package jdk.javadoc.internal.doclets.formats.html; import java.util.*; ! import javax.lang.model.element.TypeElement; ! import javax.lang.model.element.VariableElement; + import com.sun.source.doctree.DocTree; + + import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder; + import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants; + import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle; + import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag; + import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree; + import jdk.javadoc.internal.doclets.formats.html.markup.RawHtml; + import jdk.javadoc.internal.doclets.formats.html.markup.StringContent; + import jdk.javadoc.internal.doclets.toolkit.Content; + import jdk.javadoc.internal.doclets.toolkit.SerializedFormWriter; + import jdk.javadoc.internal.doclets.toolkit.taglets.TagletWriter; + import jdk.javadoc.internal.doclets.toolkit.util.CommentHelper; + /** * Generate serialized form for serializable fields. * Documentation denoted by the tags <code>serial</code> and * <code>serialField</code> is processed. *
*** 45,63 **** * @author Joe Fialli * @author Bhavesh Patel (Modified) */ public class HtmlSerialFieldWriter extends FieldWriterImpl implements SerializedFormWriter.SerialFieldWriter { - ProgramElementDoc[] members = null; ! public HtmlSerialFieldWriter(SubWriterHolderWriter writer, ! ClassDoc classdoc) { ! super(writer, classdoc); } ! public List<FieldDoc> members(ClassDoc cd) { ! return Arrays.asList(cd.serializableFields()); } /** * Return the header for serializable fields section. * --- 57,73 ---- * @author Joe Fialli * @author Bhavesh Patel (Modified) */ public class HtmlSerialFieldWriter extends FieldWriterImpl implements SerializedFormWriter.SerialFieldWriter { ! public HtmlSerialFieldWriter(SubWriterHolderWriter writer, TypeElement typeElement) { ! super(writer, typeElement); } ! public SortedSet<VariableElement> members(TypeElement te) { ! return utils.serializableFields(te); } /** * Return the header for serializable fields section. *
*** 112,122 **** * @param fieldTypeStr the string for the field type to be documented * @param fieldDimensions the dimensions of the field string to be added * @param fieldName name of the field to be added * @param contentTree the content tree to which the member header will be added */ ! public void addMemberHeader(ClassDoc fieldType, String fieldTypeStr, String fieldDimensions, String fieldName, Content contentTree) { Content nameContent = new RawHtml(fieldName); Content heading = HtmlTree.HEADING(HtmlConstants.MEMBER_HEADING, nameContent); contentTree.addContent(heading); Content pre = new HtmlTree(HtmlTag.PRE); --- 122,132 ---- * @param fieldTypeStr the string for the field type to be documented * @param fieldDimensions the dimensions of the field string to be added * @param fieldName name of the field to be added * @param contentTree the content tree to which the member header will be added */ ! public void addMemberHeader(TypeElement fieldType, String fieldTypeStr, String fieldDimensions, String fieldName, Content contentTree) { Content nameContent = new RawHtml(fieldName); Content heading = HtmlTree.HEADING(HtmlConstants.MEMBER_HEADING, nameContent); contentTree.addContent(heading); Content pre = new HtmlTree(HtmlTag.PRE);
*** 136,175 **** * Add the deprecated information for this member. * * @param field the field to document. * @param contentTree the tree to which the deprecated info will be added */ ! public void addMemberDeprecatedInfo(FieldDoc field, Content contentTree) { addDeprecatedInfo(field, contentTree); } /** * 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); } } /** * Add the description text for this member represented by the tag. * * @param serialFieldTag the field to document (represented by tag) * @param contentTree the tree to which the deprecated info will be added */ ! public void addMemberDescription(SerialFieldTag serialFieldTag, Content contentTree) { ! String serialFieldTagDesc = serialFieldTag.description().trim(); ! if (!serialFieldTagDesc.isEmpty()) { ! Content serialFieldContent = new RawHtml(serialFieldTagDesc); Content div = HtmlTree.DIV(HtmlStyle.block, serialFieldContent); contentTree.addContent(div); } } --- 146,186 ---- * Add the deprecated information for this member. * * @param field the field to document. * @param contentTree the tree to which the deprecated info will be added */ ! public void addMemberDeprecatedInfo(VariableElement field, Content contentTree) { addDeprecatedInfo(field, contentTree); } /** * 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(VariableElement field, Content contentTree) { ! if (!utils.getBody(field).isEmpty()) { writer.addInlineComment(field, contentTree); } ! List<? extends DocTree> tags = utils.getBlockTags(field, DocTree.Kind.SERIAL); ! if (!tags.isEmpty()) { ! writer.addInlineComment(field, tags.get(0), contentTree); } } /** * Add the description text for this member represented by the tag. * * @param serialFieldTag the field to document (represented by tag) * @param contentTree the tree to which the deprecated info will be added */ ! public void addMemberDescription(VariableElement field, DocTree serialFieldTag, Content contentTree) { ! CommentHelper ch = utils.getCommentHelper(field); ! List<? extends DocTree> description = ch.getDescription(configuration, serialFieldTag); ! if (!description.isEmpty()) { ! Content serialFieldContent = new RawHtml(ch.getText(description)); Content div = HtmlTree.DIV(HtmlStyle.block, serialFieldContent); contentTree.addContent(div); } }
*** 177,189 **** * Add the tag information for this member. * * @param field the field to document. * @param contentTree the tree to which the member tags info will be added */ ! public void addMemberTags(FieldDoc field, Content contentTree) { Content tagContent = new ContentBuilder(); ! TagletWriter.genTagOuput(configuration.tagletManager, field, configuration.tagletManager.getCustomTaglets(field), writer.getTagletWriterInstance(false), tagContent); Content dlTags = new HtmlTree(HtmlTag.DL); dlTags.addContent(tagContent); contentTree.addContent(dlTags); // TODO: what if empty? --- 188,200 ---- * Add the tag information for this member. * * @param field the field to document. * @param contentTree the tree to which the member tags info will be added */ ! public void addMemberTags(VariableElement field, Content contentTree) { Content tagContent = new ContentBuilder(); ! TagletWriter.genTagOutput(configuration.tagletManager, field, configuration.tagletManager.getCustomTaglets(field), writer.getTagletWriterInstance(false), tagContent); Content dlTags = new HtmlTree(HtmlTag.DL); dlTags.addContent(tagContent); contentTree.addContent(dlTags); // TODO: what if empty?
*** 195,210 **** * 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; } } --- 206,221 ---- * 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(VariableElement field) { if (!configuration.nocomment) { ! if(!utils.getBody(field).isEmpty() || writer.hasSerializationOverviewTags(field)) return true; } ! if (utils.isDeprecated(field)) return true; return false; } }