mirror of
https://github.com/openjdk/jdk.git
synced 2026-02-05 07:58:40 +00:00
8012308: Remove TagletOutput in favor of direct use of Content
Reviewed-by: darcy
This commit is contained in:
parent
2a88c7b71d
commit
997db01200
@ -348,11 +348,10 @@ public abstract class AbstractMemberWriter {
|
||||
* @param contentTree the content tree to which the deprecated information will be added.
|
||||
*/
|
||||
protected void addDeprecatedInfo(ProgramElementDoc member, Content contentTree) {
|
||||
TagletOutput output = (new DeprecatedTaglet()).getTagletOutput(member,
|
||||
Content output = (new DeprecatedTaglet()).getTagletOutput(member,
|
||||
writer.getTagletWriterInstance(false));
|
||||
Content body = ((TagletOutputImpl) output).getContent();
|
||||
if (!body.isEmpty()) {
|
||||
Content deprecatedContent = body;
|
||||
if (!output.isEmpty()) {
|
||||
Content deprecatedContent = output;
|
||||
Content div = HtmlTree.DIV(HtmlStyle.block, deprecatedContent);
|
||||
contentTree.addContent(div);
|
||||
}
|
||||
|
||||
@ -395,9 +395,8 @@ public class ClassWriterImpl extends SubWriterHolderWriter
|
||||
*/
|
||||
public void addTypeParamInfo(Content classInfoTree) {
|
||||
if (classDoc.typeParamTags().length > 0) {
|
||||
TagletOutput output = (new ParamTaglet()).getTagletOutput(classDoc,
|
||||
Content typeParam = (new ParamTaglet()).getTagletOutput(classDoc,
|
||||
getTagletWriterInstance(false));
|
||||
Content typeParam = ((TagletOutputImpl) output).getContent();
|
||||
Content dl = HtmlTree.DL(typeParam);
|
||||
classInfoTree.addContent(dl);
|
||||
}
|
||||
|
||||
@ -246,11 +246,11 @@ public class HtmlDocletWriter extends HtmlDocWriter {
|
||||
if (doc instanceof MethodDoc) {
|
||||
addMethodInfo((MethodDoc) doc, dl);
|
||||
}
|
||||
TagletOutputImpl output = new TagletOutputImpl();
|
||||
Content output = new ContentBuilder();
|
||||
TagletWriter.genTagOuput(configuration.tagletManager, doc,
|
||||
configuration.tagletManager.getCustomTaglets(doc),
|
||||
getTagletWriterInstance(false), output);
|
||||
dl.addContent(output.getContent());
|
||||
dl.addContent(output);
|
||||
htmltree.addContent(dl);
|
||||
}
|
||||
|
||||
@ -262,11 +262,11 @@ public class HtmlDocletWriter extends HtmlDocWriter {
|
||||
* @return true if there are tags to be printed else return false.
|
||||
*/
|
||||
protected boolean hasSerializationOverviewTags(FieldDoc field) {
|
||||
TagletOutputImpl output = new TagletOutputImpl();
|
||||
Content output = new ContentBuilder();
|
||||
TagletWriter.genTagOuput(configuration.tagletManager, field,
|
||||
configuration.tagletManager.getCustomTaglets(field),
|
||||
getTagletWriterInstance(false), output);
|
||||
return !output.getContent().isEmpty();
|
||||
return !output.isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1583,11 +1583,11 @@ public class HtmlDocletWriter extends HtmlDocWriter {
|
||||
result.addContent(seeTagToContent((SeeTag) tagelem));
|
||||
} else if (! tagName.equals("Text")) {
|
||||
boolean wasEmpty = result.isEmpty();
|
||||
TagletOutput output = TagletWriter.getInlineTagOuput(
|
||||
Content output = TagletWriter.getInlineTagOuput(
|
||||
configuration.tagletManager, holderTag,
|
||||
tagelem, getTagletWriterInstance(isFirstSentence));
|
||||
if (output != null)
|
||||
result.addContent(((TagletOutputImpl) output).getContent());
|
||||
result.addContent(output);
|
||||
if (wasEmpty && isFirstSentence && tagelem.name().equals("@inheritDoc") && !result.isEmpty()) {
|
||||
break;
|
||||
} else if (configuration.docrootparent.length() > 0 &&
|
||||
@ -1726,7 +1726,7 @@ public class HtmlDocletWriter extends HtmlDocWriter {
|
||||
return text;
|
||||
}
|
||||
|
||||
static Set<String> blockTags = new HashSet<>();
|
||||
static Set<String> blockTags = new HashSet<String>();
|
||||
static {
|
||||
for (HtmlTag t: HtmlTag.values()) {
|
||||
if (t.blockType == HtmlTag.BlockType.BLOCK)
|
||||
|
||||
@ -186,11 +186,10 @@ public class HtmlSerialFieldWriter extends FieldWriterImpl
|
||||
* @param contentTree the tree to which the member tags info will be added
|
||||
*/
|
||||
public void addMemberTags(FieldDoc field, Content contentTree) {
|
||||
TagletOutputImpl output = new TagletOutputImpl();
|
||||
Content tagContent = new ContentBuilder();
|
||||
TagletWriter.genTagOuput(configuration.tagletManager, field,
|
||||
configuration.tagletManager.getCustomTaglets(field),
|
||||
writer.getTagletWriterInstance(false), output);
|
||||
Content tagContent = output.getContent();
|
||||
writer.getTagletWriterInstance(false), tagContent);
|
||||
Content dlTags = new HtmlTree(HtmlTag.DL);
|
||||
dlTags.addContent(tagContent);
|
||||
contentTree.addContent(dlTags); // TODO: what if empty?
|
||||
|
||||
@ -146,13 +146,12 @@ public class HtmlSerialMethodWriter extends MethodWriterImpl implements
|
||||
* @param methodsContentTree the tree to which the member tags info will be added
|
||||
*/
|
||||
public void addMemberTags(MethodDoc member, Content methodsContentTree) {
|
||||
TagletOutputImpl output = new TagletOutputImpl();
|
||||
Content tagContent = new ContentBuilder();
|
||||
TagletManager tagletManager =
|
||||
configuration.tagletManager;
|
||||
TagletWriter.genTagOuput(tagletManager, member,
|
||||
tagletManager.getSerializedFormTaglets(),
|
||||
writer.getTagletWriterInstance(false), output);
|
||||
Content tagContent = output.getContent();
|
||||
writer.getTagletWriterInstance(false), tagContent);
|
||||
Content dlTags = new HtmlTree(HtmlTag.DL);
|
||||
dlTags.addContent(tagContent);
|
||||
methodsContentTree.addContent(dlTags); // TODO: what if empty?
|
||||
|
||||
@ -1,97 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 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
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* 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 com.sun.tools.doclets.formats.html.markup.ContentBuilder;
|
||||
import com.sun.tools.doclets.formats.html.markup.RawHtml;
|
||||
import com.sun.tools.doclets.internal.toolkit.Content;
|
||||
import com.sun.tools.doclets.internal.toolkit.taglets.*;
|
||||
|
||||
/**
|
||||
* The output for HTML taglets.
|
||||
*
|
||||
* <p><b>This is NOT part of any supported API.
|
||||
* If you write code that depends on this, you do so at your own risk.
|
||||
* This code and its internal interfaces are subject to change or
|
||||
* deletion without notice.</b>
|
||||
*
|
||||
* @since 1.5
|
||||
* @author Jamie Ho
|
||||
* @author Jonathan Gibbons (rewrite)
|
||||
*/
|
||||
|
||||
public class TagletOutputImpl implements TagletOutput {
|
||||
|
||||
private ContentBuilder content;
|
||||
|
||||
public TagletOutputImpl() {
|
||||
content = new ContentBuilder();
|
||||
}
|
||||
|
||||
public TagletOutputImpl(String o) {
|
||||
setOutput(o);
|
||||
}
|
||||
|
||||
public TagletOutputImpl(Content c) {
|
||||
setOutput(c);
|
||||
}
|
||||
|
||||
Content getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void setOutput (Object o) {
|
||||
content = new ContentBuilder();
|
||||
if (o != null) {
|
||||
if (o instanceof String)
|
||||
content.addContent(new RawHtml((String) o));
|
||||
else if (o instanceof Content)
|
||||
content.addContent((Content) o);
|
||||
else if (o instanceof TagletOutputImpl)
|
||||
content.addContent(((TagletOutputImpl) o).content);
|
||||
else
|
||||
throw new IllegalArgumentException(o.getClass().getName());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void appendOutput(TagletOutput o) {
|
||||
if (o instanceof TagletOutputImpl)
|
||||
content.addContent(((TagletOutputImpl) o).content);
|
||||
else
|
||||
throw new IllegalArgumentException(o.getClass().getName());
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return content.toString();
|
||||
}
|
||||
|
||||
}
|
||||
@ -27,9 +27,7 @@ package com.sun.tools.doclets.formats.html;
|
||||
|
||||
import com.sun.javadoc.*;
|
||||
import com.sun.tools.doclets.formats.html.markup.ContentBuilder;
|
||||
import com.sun.tools.doclets.formats.html.markup.HtmlAttr;
|
||||
import com.sun.tools.doclets.formats.html.markup.HtmlStyle;
|
||||
import com.sun.tools.doclets.formats.html.markup.HtmlTag;
|
||||
import com.sun.tools.doclets.formats.html.markup.HtmlTree;
|
||||
import com.sun.tools.doclets.formats.html.markup.RawHtml;
|
||||
import com.sun.tools.doclets.formats.html.markup.StringContent;
|
||||
@ -65,34 +63,36 @@ public class TagletWriterImpl extends TagletWriter {
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public TagletOutput getOutputInstance() {
|
||||
return new TagletOutputImpl();
|
||||
public Content getOutputInstance() {
|
||||
return new ContentBuilder();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected TagletOutput codeTagOutput(Tag tag) {
|
||||
protected Content codeTagOutput(Tag tag) {
|
||||
Content result = HtmlTree.CODE(new StringContent(tag.text()));
|
||||
return new TagletOutputImpl(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public TagletOutput getDocRootOutput() {
|
||||
public Content getDocRootOutput() {
|
||||
String path;
|
||||
if (configuration.docrootparent.length() > 0)
|
||||
return new TagletOutputImpl(configuration.docrootparent);
|
||||
path = configuration.docrootparent;
|
||||
else if (htmlWriter.pathToRoot.isEmpty())
|
||||
return new TagletOutputImpl(".");
|
||||
path = ".";
|
||||
else
|
||||
return new TagletOutputImpl(htmlWriter.pathToRoot.getPath());
|
||||
path = htmlWriter.pathToRoot.getPath();
|
||||
return new StringContent(path);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public TagletOutput deprecatedTagOutput(Doc doc) {
|
||||
public Content deprecatedTagOutput(Doc doc) {
|
||||
ContentBuilder result = new ContentBuilder();
|
||||
Tag[] deprs = doc.tags("deprecated");
|
||||
if (doc instanceof ClassDoc) {
|
||||
@ -104,7 +104,7 @@ public class TagletWriterImpl extends TagletWriter {
|
||||
Tag[] commentTags = deprs[0].inlineTags();
|
||||
if (commentTags.length > 0) {
|
||||
result.addContent(commentTagsToOutput(null, doc,
|
||||
deprs[0].inlineTags(), false).getContent()
|
||||
deprs[0].inlineTags(), false)
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -116,9 +116,9 @@ public class TagletWriterImpl extends TagletWriter {
|
||||
new StringContent(configuration.getText("doclet.Deprecated"))));
|
||||
result.addContent(RawHtml.nbsp);
|
||||
if (deprs.length > 0) {
|
||||
TagletOutputImpl body = commentTagsToOutput(null, doc,
|
||||
Content body = commentTagsToOutput(null, doc,
|
||||
deprs[0].inlineTags(), false);
|
||||
result.addContent(HtmlTree.I(body.getContent()));
|
||||
result.addContent(HtmlTree.I(body));
|
||||
}
|
||||
} else {
|
||||
if (Util.isDeprecated(member.containingClass())) {
|
||||
@ -128,15 +128,15 @@ public class TagletWriterImpl extends TagletWriter {
|
||||
}
|
||||
}
|
||||
}
|
||||
return new TagletOutputImpl(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected TagletOutput literalTagOutput(Tag tag) {
|
||||
protected Content literalTagOutput(Tag tag) {
|
||||
Content result = new StringContent(tag.text());
|
||||
return new TagletOutputImpl(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -149,53 +149,53 @@ public class TagletWriterImpl extends TagletWriter {
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public TagletOutput getParamHeader(String header) {
|
||||
public Content getParamHeader(String header) {
|
||||
HtmlTree result = HtmlTree.DT(HtmlTree.SPAN(HtmlStyle.strong,
|
||||
new StringContent(header)));
|
||||
return new TagletOutputImpl(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public TagletOutput paramTagOutput(ParamTag paramTag, String paramName) {
|
||||
public Content paramTagOutput(ParamTag paramTag, String paramName) {
|
||||
ContentBuilder body = new ContentBuilder();
|
||||
body.addContent(HtmlTree.CODE(new RawHtml(paramName)));
|
||||
body.addContent(" - ");
|
||||
body.addContent(htmlWriter.commentTagsToContent(paramTag, null, paramTag.inlineTags(), false));
|
||||
HtmlTree result = HtmlTree.DD(body);
|
||||
return new TagletOutputImpl(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public TagletOutput propertyTagOutput(Tag tag, String prefix) {
|
||||
public Content propertyTagOutput(Tag tag, String prefix) {
|
||||
Content body = new ContentBuilder();
|
||||
body.addContent(new RawHtml(prefix));
|
||||
body.addContent(" ");
|
||||
body.addContent(HtmlTree.CODE(new RawHtml(tag.text())));
|
||||
body.addContent(".");
|
||||
Content result = HtmlTree.P(body);
|
||||
return new TagletOutputImpl(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public TagletOutput returnTagOutput(Tag returnTag) {
|
||||
public Content returnTagOutput(Tag returnTag) {
|
||||
ContentBuilder result = new ContentBuilder();
|
||||
result.addContent(HtmlTree.DT(HtmlTree.SPAN(HtmlStyle.strong,
|
||||
new StringContent(configuration.getText("doclet.Returns")))));
|
||||
result.addContent(HtmlTree.DD(htmlWriter.commentTagsToContent(
|
||||
returnTag, null, returnTag.inlineTags(), false)));
|
||||
return new TagletOutputImpl(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public TagletOutput seeTagOutput(Doc holder, SeeTag[] seeTags) {
|
||||
public Content seeTagOutput(Doc holder, SeeTag[] seeTags) {
|
||||
ContentBuilder body = new ContentBuilder();
|
||||
if (seeTags.length > 0) {
|
||||
for (int i = 0; i < seeTags.length; ++i) {
|
||||
@ -227,13 +227,13 @@ public class TagletWriterImpl extends TagletWriter {
|
||||
}
|
||||
}
|
||||
if (body.isEmpty())
|
||||
return new TagletOutputImpl(body);
|
||||
return body;
|
||||
|
||||
ContentBuilder result = new ContentBuilder();
|
||||
result.addContent(HtmlTree.DT(HtmlTree.SPAN(HtmlStyle.strong,
|
||||
new StringContent(configuration.getText("doclet.See_Also")))));
|
||||
result.addContent(HtmlTree.DD(body));
|
||||
return new TagletOutputImpl(result);
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
@ -247,7 +247,7 @@ public class TagletWriterImpl extends TagletWriter {
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public TagletOutput simpleTagOutput(Tag[] simpleTags, String header) {
|
||||
public Content simpleTagOutput(Tag[] simpleTags, String header) {
|
||||
ContentBuilder result = new ContentBuilder();
|
||||
result.addContent(HtmlTree.DT(HtmlTree.SPAN(HtmlStyle.strong, new RawHtml(header))));
|
||||
ContentBuilder body = new ContentBuilder();
|
||||
@ -259,34 +259,34 @@ public class TagletWriterImpl extends TagletWriter {
|
||||
simpleTags[i], null, simpleTags[i].inlineTags(), false));
|
||||
}
|
||||
result.addContent(HtmlTree.DD(body));
|
||||
return new TagletOutputImpl(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public TagletOutput simpleTagOutput(Tag simpleTag, String header) {
|
||||
public Content simpleTagOutput(Tag simpleTag, String header) {
|
||||
ContentBuilder result = new ContentBuilder();
|
||||
result.addContent(HtmlTree.DT(HtmlTree.SPAN(HtmlStyle.strong, new RawHtml(header))));
|
||||
Content body = htmlWriter.commentTagsToContent(
|
||||
simpleTag, null, simpleTag.inlineTags(), false);
|
||||
result.addContent(HtmlTree.DD(body));
|
||||
return new TagletOutputImpl(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public TagletOutput getThrowsHeader() {
|
||||
public Content getThrowsHeader() {
|
||||
HtmlTree result = HtmlTree.DT(HtmlTree.SPAN(HtmlStyle.strong,
|
||||
new StringContent(configuration.getText("doclet.Throws"))));
|
||||
return new TagletOutputImpl(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public TagletOutput throwsTagOutput(ThrowsTag throwsTag) {
|
||||
public Content throwsTagOutput(ThrowsTag throwsTag) {
|
||||
ContentBuilder body = new ContentBuilder();
|
||||
Content excName = (throwsTag.exceptionType() == null) ?
|
||||
new RawHtml(throwsTag.exceptionName()) :
|
||||
@ -299,50 +299,50 @@ public class TagletWriterImpl extends TagletWriter {
|
||||
body.addContent(" - ");
|
||||
body.addContent(desc);
|
||||
}
|
||||
HtmlTree res2 = HtmlTree.DD(body);
|
||||
return new TagletOutputImpl(res2);
|
||||
HtmlTree result = HtmlTree.DD(body);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public TagletOutput throwsTagOutput(Type throwsType) {
|
||||
public Content throwsTagOutput(Type throwsType) {
|
||||
HtmlTree result = HtmlTree.DD(HtmlTree.CODE(htmlWriter.getLink(
|
||||
new LinkInfoImpl(configuration, LinkInfoImpl.Kind.MEMBER, throwsType))));
|
||||
return new TagletOutputImpl(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public TagletOutput valueTagOutput(FieldDoc field, String constantVal,
|
||||
public Content valueTagOutput(FieldDoc field, String constantVal,
|
||||
boolean includeLink) {
|
||||
return new TagletOutputImpl(includeLink ?
|
||||
return includeLink ?
|
||||
htmlWriter.getDocLink(LinkInfoImpl.Kind.VALUE_TAG, field,
|
||||
constantVal, false) : new RawHtml(constantVal));
|
||||
constantVal, false) : new RawHtml(constantVal);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public TagletOutputImpl commentTagsToOutput(Tag holderTag, Tag[] tags) {
|
||||
public Content commentTagsToOutput(Tag holderTag, Tag[] tags) {
|
||||
return commentTagsToOutput(holderTag, null, tags, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public TagletOutputImpl commentTagsToOutput(Doc holderDoc, Tag[] tags) {
|
||||
public Content commentTagsToOutput(Doc holderDoc, Tag[] tags) {
|
||||
return commentTagsToOutput(null, holderDoc, tags, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public TagletOutputImpl commentTagsToOutput(Tag holderTag,
|
||||
public Content commentTagsToOutput(Tag holderTag,
|
||||
Doc holderDoc, Tag[] tags, boolean isFirstSentence) {
|
||||
return new TagletOutputImpl(htmlWriter.commentTagsToContent(
|
||||
holderTag, holderDoc, tags, isFirstSentence));
|
||||
return htmlWriter.commentTagsToContent(
|
||||
holderTag, holderDoc, tags, isFirstSentence);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -40,6 +40,7 @@ public class ContentBuilder extends Content {
|
||||
|
||||
@Override
|
||||
public void addContent(Content content) {
|
||||
nullCheck(content);
|
||||
if ((content instanceof ContentBuilder) && content.isEmpty())
|
||||
return;
|
||||
ensureMutableContents();
|
||||
|
||||
@ -26,6 +26,7 @@
|
||||
package com.sun.tools.doclets.internal.toolkit.taglets;
|
||||
|
||||
import com.sun.javadoc.Tag;
|
||||
import com.sun.tools.doclets.internal.toolkit.Content;
|
||||
|
||||
/**
|
||||
* An abstract class that implements the {@link Taglet} interface and
|
||||
@ -59,7 +60,7 @@ public abstract class BasePropertyTaglet extends BaseTaglet {
|
||||
* @param tagletWriter the taglet writer for output.
|
||||
* @return the TagletOutput representation of this <code>Tag</code>.
|
||||
*/
|
||||
public TagletOutput getTagletOutput(Tag tag, TagletWriter tagletWriter) {
|
||||
public Content getTagletOutput(Tag tag, TagletWriter tagletWriter) {
|
||||
return tagletWriter.propertyTagOutput(tag, getText(tagletWriter));
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 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
|
||||
@ -26,6 +26,7 @@
|
||||
package com.sun.tools.doclets.internal.toolkit.taglets;
|
||||
|
||||
import com.sun.javadoc.*;
|
||||
import com.sun.tools.doclets.internal.toolkit.Content;
|
||||
|
||||
/**
|
||||
* An abstract class for that implements the {@link Taglet} interface.
|
||||
@ -130,7 +131,7 @@ public abstract class BaseTaglet implements Taglet {
|
||||
* {@inheritDoc}
|
||||
* @throws IllegalArgumentException thrown when the method is not supported by the taglet.
|
||||
*/
|
||||
public TagletOutput getTagletOutput(Tag tag, TagletWriter writer) {
|
||||
public Content getTagletOutput(Tag tag, TagletWriter writer) {
|
||||
throw new IllegalArgumentException("Method not supported in taglet " + getName() + ".");
|
||||
}
|
||||
|
||||
@ -138,7 +139,7 @@ public abstract class BaseTaglet implements Taglet {
|
||||
* {@inheritDoc}
|
||||
* @throws IllegalArgumentException thrown when the method is not supported by the taglet.
|
||||
*/
|
||||
public TagletOutput getTagletOutput(Doc holder, TagletWriter writer) {
|
||||
public Content getTagletOutput(Doc holder, TagletWriter writer) {
|
||||
throw new IllegalArgumentException("Method not supported in taglet " + getName() + ".");
|
||||
}
|
||||
}
|
||||
|
||||
@ -26,6 +26,7 @@ package com.sun.tools.doclets.internal.toolkit.taglets;
|
||||
|
||||
import java.util.Map;
|
||||
import com.sun.javadoc.Tag;
|
||||
import com.sun.tools.doclets.internal.toolkit.Content;
|
||||
|
||||
/**
|
||||
* An inline Taglet used to denote literal code fragments.
|
||||
@ -64,7 +65,7 @@ public class CodeTaglet extends BaseInlineTaglet {
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public TagletOutput getTagletOutput(Tag tag, TagletWriter writer) {
|
||||
public Content getTagletOutput(Tag tag, TagletWriter writer) {
|
||||
return writer.codeTagOutput(tag);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 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
|
||||
@ -26,6 +26,7 @@
|
||||
package com.sun.tools.doclets.internal.toolkit.taglets;
|
||||
|
||||
import com.sun.javadoc.*;
|
||||
import com.sun.tools.doclets.internal.toolkit.Content;
|
||||
|
||||
/**
|
||||
* A taglet that represents the @deprecated tag.
|
||||
@ -48,7 +49,7 @@ public class DeprecatedTaglet extends BaseTaglet{
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public TagletOutput getTagletOutput(Doc holder, TagletWriter writer) {
|
||||
public Content getTagletOutput(Doc holder, TagletWriter writer) {
|
||||
return writer.deprecatedTagOutput(holder);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2001, 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
|
||||
@ -26,6 +26,7 @@
|
||||
package com.sun.tools.doclets.internal.toolkit.taglets;
|
||||
|
||||
import com.sun.javadoc.*;
|
||||
import com.sun.tools.doclets.internal.toolkit.Content;
|
||||
|
||||
/**
|
||||
* An inline Taglet representing {@docRoot}. This taglet is
|
||||
@ -60,7 +61,7 @@ public class DocRootTaglet extends BaseInlineTaglet {
|
||||
* @param writer a {@link TagletWriter} Taglet writer.
|
||||
* @return the string representation of this <code>Tag</code>.
|
||||
*/
|
||||
public TagletOutput getTagletOutput(Tag tag, TagletWriter writer) {
|
||||
public Content getTagletOutput(Tag tag, TagletWriter writer) {
|
||||
return writer.getDocRootOutput();
|
||||
}
|
||||
}
|
||||
|
||||
@ -27,6 +27,7 @@ package com.sun.tools.doclets.internal.toolkit.taglets;
|
||||
|
||||
import com.sun.javadoc.*;
|
||||
import com.sun.tools.doclets.internal.toolkit.Configuration;
|
||||
import com.sun.tools.doclets.internal.toolkit.Content;
|
||||
import com.sun.tools.doclets.internal.toolkit.util.*;
|
||||
|
||||
/**
|
||||
@ -114,9 +115,9 @@ public class InheritDocTaglet extends BaseInlineTaglet {
|
||||
* (class) docs.
|
||||
* @param isFirstSentence true if we only want to inherit the first sentence.
|
||||
*/
|
||||
private TagletOutput retrieveInheritedDocumentation(TagletWriter writer,
|
||||
private Content retrieveInheritedDocumentation(TagletWriter writer,
|
||||
ProgramElementDoc ped, Tag holderTag, boolean isFirstSentence) {
|
||||
TagletOutput replacement = writer.getOutputInstance();
|
||||
Content replacement = writer.getOutputInstance();
|
||||
|
||||
Configuration configuration = writer.configuration();
|
||||
Taglet inheritableTaglet = holderTag == null ?
|
||||
@ -157,9 +158,9 @@ public class InheritDocTaglet extends BaseInlineTaglet {
|
||||
* to the generated page.
|
||||
* @param tag the <code>Tag</code> representation of this custom tag.
|
||||
* @param tagletWriter the taglet writer for output.
|
||||
* @return the TagletOutput representation of this <code>Tag</code>.
|
||||
* @return the Content representation of this <code>Tag</code>.
|
||||
*/
|
||||
public TagletOutput getTagletOutput(Tag tag, TagletWriter tagletWriter) {
|
||||
public Content getTagletOutput(Tag tag, TagletWriter tagletWriter) {
|
||||
if (! (tag.holder() instanceof ProgramElementDoc)) {
|
||||
return tagletWriter.getOutputInstance();
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 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
|
||||
@ -26,6 +26,8 @@
|
||||
package com.sun.tools.doclets.internal.toolkit.taglets;
|
||||
|
||||
import com.sun.javadoc.*;
|
||||
import com.sun.tools.doclets.formats.html.markup.RawHtml;
|
||||
import com.sun.tools.doclets.internal.toolkit.Content;
|
||||
|
||||
/**
|
||||
* This taglet acts as a wrapper to enable
|
||||
@ -115,20 +117,20 @@ public class LegacyTaglet implements Taglet {
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public TagletOutput getTagletOutput(Tag tag, TagletWriter writer)
|
||||
public Content getTagletOutput(Tag tag, TagletWriter writer)
|
||||
throws IllegalArgumentException {
|
||||
TagletOutput output = writer.getOutputInstance();
|
||||
output.setOutput(legacyTaglet.toString(tag));
|
||||
Content output = writer.getOutputInstance();
|
||||
output.addContent(new RawHtml(legacyTaglet.toString(tag)));
|
||||
return output;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public TagletOutput getTagletOutput(Doc holder, TagletWriter writer)
|
||||
public Content getTagletOutput(Doc holder, TagletWriter writer)
|
||||
throws IllegalArgumentException {
|
||||
TagletOutput output = writer.getOutputInstance();
|
||||
output.setOutput(legacyTaglet.toString(holder.tags(getName())));
|
||||
Content output = writer.getOutputInstance();
|
||||
output.addContent(new RawHtml(legacyTaglet.toString(holder.tags(getName()))));
|
||||
return output;
|
||||
}
|
||||
}
|
||||
|
||||
@ -27,6 +27,7 @@ package com.sun.tools.doclets.internal.toolkit.taglets;
|
||||
import java.util.Map;
|
||||
|
||||
import com.sun.javadoc.Tag;
|
||||
import com.sun.tools.doclets.internal.toolkit.Content;
|
||||
|
||||
|
||||
/**
|
||||
@ -63,7 +64,7 @@ public class LiteralTaglet extends BaseInlineTaglet {
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public TagletOutput getTagletOutput(Tag tag, TagletWriter writer) {
|
||||
public Content getTagletOutput(Tag tag, TagletWriter writer) {
|
||||
return writer.literalTagOutput(tag);
|
||||
}
|
||||
}
|
||||
|
||||
@ -28,6 +28,7 @@ package com.sun.tools.doclets.internal.toolkit.taglets;
|
||||
import java.util.*;
|
||||
|
||||
import com.sun.javadoc.*;
|
||||
import com.sun.tools.doclets.internal.toolkit.Content;
|
||||
import com.sun.tools.doclets.internal.toolkit.util.*;
|
||||
|
||||
/**
|
||||
@ -165,12 +166,12 @@ public class ParamTaglet extends BaseTaglet implements InheritableTaglet {
|
||||
* @param writer the TagletWriter that will write this tag.
|
||||
* @return the TagletOutput representation of these <code>ParamTag</code>s.
|
||||
*/
|
||||
public TagletOutput getTagletOutput(Doc holder, TagletWriter writer) {
|
||||
public Content getTagletOutput(Doc holder, TagletWriter writer) {
|
||||
if (holder instanceof ExecutableMemberDoc) {
|
||||
ExecutableMemberDoc member = (ExecutableMemberDoc) holder;
|
||||
TagletOutput output = getTagletOutput(false, member, writer,
|
||||
Content output = getTagletOutput(false, member, writer,
|
||||
member.typeParameters(), member.typeParamTags());
|
||||
output.appendOutput(getTagletOutput(true, member, writer,
|
||||
output.addContent(getTagletOutput(true, member, writer,
|
||||
member.parameters(), member.paramTags()));
|
||||
return output;
|
||||
} else {
|
||||
@ -191,12 +192,12 @@ public class ParamTaglet extends BaseTaglet implements InheritableTaglet {
|
||||
*
|
||||
* @return the TagletOutput representation of these <code>ParamTag</code>s.
|
||||
*/
|
||||
private TagletOutput getTagletOutput(boolean isNonTypeParams, Doc holder,
|
||||
private Content getTagletOutput(boolean isNonTypeParams, Doc holder,
|
||||
TagletWriter writer, Object[] formalParameters, ParamTag[] paramTags) {
|
||||
TagletOutput result = writer.getOutputInstance();
|
||||
Content result = writer.getOutputInstance();
|
||||
Set<String> alreadyDocumented = new HashSet<String>();
|
||||
if (paramTags.length > 0) {
|
||||
result.appendOutput(
|
||||
result.addContent(
|
||||
processParamTags(isNonTypeParams, paramTags,
|
||||
getRankMap(formalParameters), writer, alreadyDocumented)
|
||||
);
|
||||
@ -204,7 +205,7 @@ public class ParamTaglet extends BaseTaglet implements InheritableTaglet {
|
||||
if (alreadyDocumented.size() != formalParameters.length) {
|
||||
//Some parameters are missing corresponding @param tags.
|
||||
//Try to inherit them.
|
||||
result.appendOutput(getInheritedTagletOutput (isNonTypeParams, holder,
|
||||
result.addContent(getInheritedTagletOutput (isNonTypeParams, holder,
|
||||
writer, formalParameters, alreadyDocumented));
|
||||
}
|
||||
return result;
|
||||
@ -214,10 +215,10 @@ public class ParamTaglet extends BaseTaglet implements InheritableTaglet {
|
||||
* Loop through each indivitual parameter. It it does not have a
|
||||
* corresponding param tag, try to inherit it.
|
||||
*/
|
||||
private TagletOutput getInheritedTagletOutput(boolean isNonTypeParams, Doc holder,
|
||||
private Content getInheritedTagletOutput(boolean isNonTypeParams, Doc holder,
|
||||
TagletWriter writer, Object[] formalParameters,
|
||||
Set<String> alreadyDocumented) {
|
||||
TagletOutput result = writer.getOutputInstance();
|
||||
Content result = writer.getOutputInstance();
|
||||
if ((! alreadyDocumented.contains(null)) &&
|
||||
holder instanceof MethodDoc) {
|
||||
for (int i = 0; i < formalParameters.length; i++) {
|
||||
@ -231,7 +232,7 @@ public class ParamTaglet extends BaseTaglet implements InheritableTaglet {
|
||||
String.valueOf(i), ! isNonTypeParams));
|
||||
if (inheritedDoc.inlineTags != null &&
|
||||
inheritedDoc.inlineTags.length > 0) {
|
||||
result.appendOutput(
|
||||
result.addContent(
|
||||
processParamTag(isNonTypeParams, writer,
|
||||
(ParamTag) inheritedDoc.holderTag,
|
||||
isNonTypeParams ?
|
||||
@ -261,12 +262,12 @@ public class ParamTaglet extends BaseTaglet implements InheritableTaglet {
|
||||
* of a rank of a parameter to its name. This is
|
||||
* used to ensure that the right name is used
|
||||
* when parameter documentation is inherited.
|
||||
* @return the TagletOutput representation of this <code>Tag</code>.
|
||||
* @return the Content representation of this <code>Tag</code>.
|
||||
*/
|
||||
private TagletOutput processParamTags(boolean isNonTypeParams,
|
||||
private Content processParamTags(boolean isNonTypeParams,
|
||||
ParamTag[] paramTags, Map<String, String> rankMap, TagletWriter writer,
|
||||
Set<String> alreadyDocumented) {
|
||||
TagletOutput result = writer.getOutputInstance();
|
||||
Content result = writer.getOutputInstance();
|
||||
if (paramTags.length > 0) {
|
||||
for (int i = 0; i < paramTags.length; ++i) {
|
||||
ParamTag pt = paramTags[i];
|
||||
@ -287,7 +288,7 @@ public class ParamTaglet extends BaseTaglet implements InheritableTaglet {
|
||||
"doclet.Type_Parameters_dup_warn",
|
||||
paramName);
|
||||
}
|
||||
result.appendOutput(processParamTag(isNonTypeParams, writer, pt,
|
||||
result.addContent(processParamTag(isNonTypeParams, writer, pt,
|
||||
pt.parameterName(), alreadyDocumented.size() == 0));
|
||||
alreadyDocumented.add(rank);
|
||||
}
|
||||
@ -295,7 +296,7 @@ public class ParamTaglet extends BaseTaglet implements InheritableTaglet {
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* Convert the individual ParamTag into TagletOutput.
|
||||
* Convert the individual ParamTag into Content.
|
||||
*
|
||||
* @param isNonTypeParams true if this is just a regular param tag. False
|
||||
* if this is a type param tag.
|
||||
@ -307,16 +308,16 @@ public class ParamTaglet extends BaseTaglet implements InheritableTaglet {
|
||||
* @param isFirstParam true if this is the first param tag being printed.
|
||||
*
|
||||
*/
|
||||
private TagletOutput processParamTag(boolean isNonTypeParams,
|
||||
private Content processParamTag(boolean isNonTypeParams,
|
||||
TagletWriter writer, ParamTag paramTag, String name,
|
||||
boolean isFirstParam) {
|
||||
TagletOutput result = writer.getOutputInstance();
|
||||
Content result = writer.getOutputInstance();
|
||||
String header = writer.configuration().getText(
|
||||
isNonTypeParams ? "doclet.Parameters" : "doclet.TypeParameters");
|
||||
if (isFirstParam) {
|
||||
result.appendOutput(writer.getParamHeader(header));
|
||||
result.addContent(writer.getParamHeader(header));
|
||||
}
|
||||
result.appendOutput(writer.paramTagOutput(paramTag,
|
||||
result.addContent(writer.paramTagOutput(paramTag,
|
||||
name));
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -26,6 +26,7 @@
|
||||
package com.sun.tools.doclets.internal.toolkit.taglets;
|
||||
|
||||
import com.sun.javadoc.*;
|
||||
import com.sun.tools.doclets.internal.toolkit.Content;
|
||||
import com.sun.tools.doclets.internal.toolkit.util.*;
|
||||
|
||||
/**
|
||||
@ -73,7 +74,7 @@ public class ReturnTaglet extends BaseExecutableMemberTaglet
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public TagletOutput getTagletOutput(Doc holder, TagletWriter writer) {
|
||||
public Content getTagletOutput(Doc holder, TagletWriter writer) {
|
||||
Type returnType = ((MethodDoc) holder).returnType();
|
||||
Tag[] tags = holder.tags(name);
|
||||
|
||||
|
||||
@ -26,6 +26,7 @@
|
||||
package com.sun.tools.doclets.internal.toolkit.taglets;
|
||||
|
||||
import com.sun.javadoc.*;
|
||||
import com.sun.tools.doclets.internal.toolkit.Content;
|
||||
import com.sun.tools.doclets.internal.toolkit.util.*;
|
||||
|
||||
/**
|
||||
@ -61,7 +62,7 @@ public class SeeTaglet extends BaseTaglet implements InheritableTaglet {
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public TagletOutput getTagletOutput(Doc holder, TagletWriter writer) {
|
||||
public Content getTagletOutput(Doc holder, TagletWriter writer) {
|
||||
SeeTag[] tags = holder.seeTags();
|
||||
if (tags.length == 0 && holder instanceof MethodDoc) {
|
||||
DocFinder.Output inheritedDoc =
|
||||
|
||||
@ -26,6 +26,7 @@
|
||||
package com.sun.tools.doclets.internal.toolkit.taglets;
|
||||
|
||||
import com.sun.javadoc.*;
|
||||
import com.sun.tools.doclets.internal.toolkit.Content;
|
||||
import com.sun.tools.doclets.internal.toolkit.util.DocFinder;
|
||||
|
||||
/**
|
||||
@ -214,14 +215,14 @@ public class SimpleTaglet extends BaseTaglet implements InheritableTaglet {
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public TagletOutput getTagletOutput(Tag tag, TagletWriter writer) {
|
||||
public Content getTagletOutput(Tag tag, TagletWriter writer) {
|
||||
return header == null || tag == null ? null : writer.simpleTagOutput(tag, header);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public TagletOutput getTagletOutput(Doc holder, TagletWriter writer) {
|
||||
public Content getTagletOutput(Doc holder, TagletWriter writer) {
|
||||
if (header == null || holder.tags(getName()).length == 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -26,6 +26,7 @@
|
||||
package com.sun.tools.doclets.internal.toolkit.taglets;
|
||||
|
||||
import com.sun.javadoc.*;
|
||||
import com.sun.tools.doclets.internal.toolkit.Content;
|
||||
|
||||
/**
|
||||
* The interface for a custom tag used by Doclets. A custom
|
||||
@ -132,14 +133,14 @@ public interface Taglet {
|
||||
|
||||
/**
|
||||
* Given the <code>Tag</code> representation of this custom
|
||||
* tag, return its TagletOutput representation, which is output
|
||||
* tag, return its Content representation, which is output
|
||||
* to the generated page.
|
||||
* @param tag the <code>Tag</code> representation of this custom tag.
|
||||
* @param writer a {@link TagletWriter} Taglet writer.
|
||||
* @throws IllegalArgumentException thrown when the method is not supported by the taglet.
|
||||
* @return the TagletOutput representation of this <code>Tag</code>.
|
||||
* @return the Content representation of this <code>Tag</code>.
|
||||
*/
|
||||
public abstract TagletOutput getTagletOutput(Tag tag, TagletWriter writer) throws IllegalArgumentException;
|
||||
public abstract Content getTagletOutput(Tag tag, TagletWriter writer) throws IllegalArgumentException;
|
||||
|
||||
/**
|
||||
* Given a <code>Doc</code> object, check if it holds any tags of
|
||||
@ -150,7 +151,7 @@ public interface Taglet {
|
||||
* @throws IllegalArgumentException thrown when the method is not supported by the taglet.
|
||||
* @return the TagletOutput representation of this <code>Tag</code>.
|
||||
*/
|
||||
public abstract TagletOutput getTagletOutput(Doc holder, TagletWriter writer) throws IllegalArgumentException;
|
||||
public abstract Content getTagletOutput(Doc holder, TagletWriter writer) throws IllegalArgumentException;
|
||||
|
||||
@Override
|
||||
public abstract String toString();
|
||||
|
||||
@ -1,57 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 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
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* 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.internal.toolkit.taglets;
|
||||
|
||||
/**
|
||||
* The interface for taglet output. This interface is needed because
|
||||
* different doclets work with different formats of output. A single taglet can
|
||||
* work with any doclet that provides an implementation of taglet output.
|
||||
*
|
||||
* <p><b>This is NOT part of any supported API.
|
||||
* If you write code that depends on this, you do so at your own risk.
|
||||
* This code and its internal interfaces are subject to change or
|
||||
* deletion without notice.</b>
|
||||
*
|
||||
* @author Jamie Ho
|
||||
* @since 1.5
|
||||
*/
|
||||
public interface TagletOutput {
|
||||
|
||||
/**
|
||||
* Set the output for the taglet.
|
||||
* @param o an object representing the output.
|
||||
*/
|
||||
public abstract void setOutput(Object o);
|
||||
|
||||
/**
|
||||
* Append the given output to this output.
|
||||
* @param o a TagletOutput representing the output.
|
||||
*/
|
||||
public abstract void appendOutput(TagletOutput o);
|
||||
|
||||
@Override
|
||||
public String toString();
|
||||
}
|
||||
@ -55,7 +55,7 @@ public abstract class TagletWriter {
|
||||
/**
|
||||
* @return an instance of an output object.
|
||||
*/
|
||||
public abstract TagletOutput getOutputInstance();
|
||||
public abstract Content getOutputInstance();
|
||||
|
||||
/**
|
||||
* Return the output for a {@code...} tag.
|
||||
@ -63,13 +63,13 @@ public abstract class TagletWriter {
|
||||
* @param tag the tag.
|
||||
* @return the output of the taglet.
|
||||
*/
|
||||
protected abstract TagletOutput codeTagOutput(Tag tag);
|
||||
protected abstract Content codeTagOutput(Tag tag);
|
||||
|
||||
/**
|
||||
* Returns the output for the DocRoot inline tag.
|
||||
* @return the output for the DocRoot inline tag.
|
||||
*/
|
||||
protected abstract TagletOutput getDocRootOutput();
|
||||
protected abstract Content getDocRootOutput();
|
||||
|
||||
/**
|
||||
* Return the deprecated tag output.
|
||||
@ -77,7 +77,7 @@ public abstract class TagletWriter {
|
||||
* @param doc the doc to write deprecated documentation for.
|
||||
* @return the output of the deprecated tag.
|
||||
*/
|
||||
protected abstract TagletOutput deprecatedTagOutput(Doc doc);
|
||||
protected abstract Content deprecatedTagOutput(Doc doc);
|
||||
|
||||
/**
|
||||
* Return the output for a {@literal...} tag.
|
||||
@ -85,7 +85,7 @@ public abstract class TagletWriter {
|
||||
* @param tag the tag.
|
||||
* @return the output of the taglet.
|
||||
*/
|
||||
protected abstract TagletOutput literalTagOutput(Tag tag);
|
||||
protected abstract Content literalTagOutput(Tag tag);
|
||||
|
||||
/**
|
||||
* Returns {@link MessageRetriever} for output purposes.
|
||||
@ -100,7 +100,7 @@ public abstract class TagletWriter {
|
||||
* @param header the header to display.
|
||||
* @return the header for the param tags.
|
||||
*/
|
||||
protected abstract TagletOutput getParamHeader(String header);
|
||||
protected abstract Content getParamHeader(String header);
|
||||
|
||||
/**
|
||||
* Return the output for param tags.
|
||||
@ -109,7 +109,7 @@ public abstract class TagletWriter {
|
||||
* @param paramName the name of the parameter.
|
||||
* @return the output of the param tag.
|
||||
*/
|
||||
protected abstract TagletOutput paramTagOutput(ParamTag paramTag,
|
||||
protected abstract Content paramTagOutput(ParamTag paramTag,
|
||||
String paramName);
|
||||
|
||||
/**
|
||||
@ -119,7 +119,7 @@ public abstract class TagletWriter {
|
||||
* @param prefix the text with which to prefix the property name.
|
||||
* @return the output of the param tag.
|
||||
*/
|
||||
protected abstract TagletOutput propertyTagOutput(Tag propertyTag, String prefix);
|
||||
protected abstract Content propertyTagOutput(Tag propertyTag, String prefix);
|
||||
|
||||
/**
|
||||
* Return the return tag output.
|
||||
@ -127,7 +127,7 @@ public abstract class TagletWriter {
|
||||
* @param returnTag the return tag to output.
|
||||
* @return the output of the return tag.
|
||||
*/
|
||||
protected abstract TagletOutput returnTagOutput(Tag returnTag);
|
||||
protected abstract Content returnTagOutput(Tag returnTag);
|
||||
|
||||
/**
|
||||
* Return the see tag output.
|
||||
@ -135,7 +135,7 @@ public abstract class TagletWriter {
|
||||
* @param seeTags the array of See tags.
|
||||
* @return the output of the see tags.
|
||||
*/
|
||||
protected abstract TagletOutput seeTagOutput(Doc holder, SeeTag[] seeTags);
|
||||
protected abstract Content seeTagOutput(Doc holder, SeeTag[] seeTags);
|
||||
|
||||
/**
|
||||
* Return the output for a simple tag.
|
||||
@ -143,7 +143,7 @@ public abstract class TagletWriter {
|
||||
* @param simpleTags the array of simple tags.
|
||||
* @return the output of the simple tags.
|
||||
*/
|
||||
protected abstract TagletOutput simpleTagOutput(Tag[] simpleTags,
|
||||
protected abstract Content simpleTagOutput(Tag[] simpleTags,
|
||||
String header);
|
||||
|
||||
/**
|
||||
@ -152,14 +152,14 @@ public abstract class TagletWriter {
|
||||
* @param simpleTag the simple tag.
|
||||
* @return the output of the simple tag.
|
||||
*/
|
||||
protected abstract TagletOutput simpleTagOutput(Tag simpleTag, String header);
|
||||
protected abstract Content simpleTagOutput(Tag simpleTag, String header);
|
||||
|
||||
/**
|
||||
* Return the header for the throws tag.
|
||||
*
|
||||
* @return the header for the throws tag.
|
||||
*/
|
||||
protected abstract TagletOutput getThrowsHeader();
|
||||
protected abstract Content getThrowsHeader();
|
||||
|
||||
/**
|
||||
* Return the header for the throws tag.
|
||||
@ -167,7 +167,7 @@ public abstract class TagletWriter {
|
||||
* @param throwsTag the throws tag.
|
||||
* @return the output of the throws tag.
|
||||
*/
|
||||
protected abstract TagletOutput throwsTagOutput(ThrowsTag throwsTag);
|
||||
protected abstract Content throwsTagOutput(ThrowsTag throwsTag);
|
||||
|
||||
/**
|
||||
* Return the output for the throws tag.
|
||||
@ -175,7 +175,7 @@ public abstract class TagletWriter {
|
||||
* @param throwsType the throws type.
|
||||
* @return the output of the throws type.
|
||||
*/
|
||||
protected abstract TagletOutput throwsTagOutput(Type throwsType);
|
||||
protected abstract Content throwsTagOutput(Type throwsType);
|
||||
|
||||
/**
|
||||
* Return the output for the value tag.
|
||||
@ -186,7 +186,7 @@ public abstract class TagletWriter {
|
||||
* constant field itself.
|
||||
* @return the output of the value tag.
|
||||
*/
|
||||
protected abstract TagletOutput valueTagOutput(FieldDoc field,
|
||||
protected abstract Content valueTagOutput(FieldDoc field,
|
||||
String constantVal, boolean includeLink);
|
||||
|
||||
/**
|
||||
@ -200,10 +200,10 @@ public abstract class TagletWriter {
|
||||
* @param output the output buffer to store the output in.
|
||||
*/
|
||||
public static void genTagOuput(TagletManager tagletManager, Doc doc,
|
||||
Taglet[] taglets, TagletWriter writer, TagletOutput output) {
|
||||
Taglet[] taglets, TagletWriter writer, Content output) {
|
||||
tagletManager.checkTags(doc, doc.tags(), false);
|
||||
tagletManager.checkTags(doc, doc.inlineTags(), true);
|
||||
TagletOutput currentOutput = null;
|
||||
Content currentOutput = null;
|
||||
for (int i = 0; i < taglets.length; i++) {
|
||||
currentOutput = null;
|
||||
if (doc instanceof ClassDoc && taglets[i] instanceof ParamTaglet) {
|
||||
@ -228,7 +228,7 @@ public abstract class TagletWriter {
|
||||
}
|
||||
if (currentOutput != null) {
|
||||
tagletManager.seenCustomTag(taglets[i].getName());
|
||||
output.appendOutput(currentOutput);
|
||||
output.addContent(currentOutput);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -242,7 +242,7 @@ public abstract class TagletWriter {
|
||||
* @param tagletWriter The taglet writer to write the output.
|
||||
* @return The output of the inline tag.
|
||||
*/
|
||||
public static TagletOutput getInlineTagOuput(TagletManager tagletManager,
|
||||
public static Content getInlineTagOuput(TagletManager tagletManager,
|
||||
Tag holderTag, Tag inlineTag, TagletWriter tagletWriter) {
|
||||
Taglet[] definedTags = tagletManager.getInlineCustomTaglets();
|
||||
//This is a custom inline tag.
|
||||
@ -251,7 +251,7 @@ public abstract class TagletWriter {
|
||||
//Given a name of a seen custom tag, remove it from the
|
||||
// set of unseen custom tags.
|
||||
tagletManager.seenCustomTag(definedTags[j].getName());
|
||||
TagletOutput output = definedTags[j].getTagletOutput(
|
||||
Content output = definedTags[j].getTagletOutput(
|
||||
holderTag != null &&
|
||||
definedTags[j].getName().equals("inheritDoc") ?
|
||||
holderTag : inlineTag, tagletWriter);
|
||||
@ -270,9 +270,9 @@ public abstract class TagletWriter {
|
||||
* @param holderTag the tag that holds the documentation.
|
||||
* @param tags array of text tags and inline tags (often alternating)
|
||||
* present in the text of interest for this doc.
|
||||
* @return the {@link TagletOutput} representing the comments.
|
||||
* @return the {@link Content} representing the comments.
|
||||
*/
|
||||
public abstract TagletOutput commentTagsToOutput(Tag holderTag, Tag[] tags);
|
||||
public abstract Content commentTagsToOutput(Tag holderTag, Tag[] tags);
|
||||
|
||||
/**
|
||||
* Converts inline tags and text to TagOutput, expanding the
|
||||
@ -283,9 +283,9 @@ public abstract class TagletWriter {
|
||||
* @param holderDoc specific doc where comment resides.
|
||||
* @param tags array of text tags and inline tags (often alternating)
|
||||
* present in the text of interest for this doc.
|
||||
* @return the {@link TagletOutput} representing the comments.
|
||||
* @return the {@link Content} representing the comments.
|
||||
*/
|
||||
public abstract TagletOutput commentTagsToOutput(Doc holderDoc, Tag[] tags);
|
||||
public abstract Content commentTagsToOutput(Doc holderDoc, Tag[] tags);
|
||||
|
||||
/**
|
||||
* Converts inline tags and text to TagOutput, expanding the
|
||||
@ -298,9 +298,9 @@ public abstract class TagletWriter {
|
||||
* @param tags array of text tags and inline tags (often alternating)
|
||||
* present in the text of interest for this doc.
|
||||
* @param isFirstSentence true if this is the first sentence.
|
||||
* @return the {@link TagletOutput} representing the comments.
|
||||
* @return the {@link Content} representing the comments.
|
||||
*/
|
||||
public abstract TagletOutput commentTagsToOutput(Tag holderTag,
|
||||
public abstract Content commentTagsToOutput(Tag holderTag,
|
||||
Doc holderDoc, Tag[] tags, boolean isFirstSentence);
|
||||
|
||||
/**
|
||||
|
||||
@ -28,6 +28,7 @@ package com.sun.tools.doclets.internal.toolkit.taglets;
|
||||
import java.util.*;
|
||||
|
||||
import com.sun.javadoc.*;
|
||||
import com.sun.tools.doclets.internal.toolkit.Content;
|
||||
import com.sun.tools.doclets.internal.toolkit.util.*;
|
||||
|
||||
/**
|
||||
@ -83,10 +84,10 @@ public class ThrowsTaglet extends BaseExecutableMemberTaglet
|
||||
/**
|
||||
* Add links for exceptions that are declared but not documented.
|
||||
*/
|
||||
private TagletOutput linkToUndocumentedDeclaredExceptions(
|
||||
private Content linkToUndocumentedDeclaredExceptions(
|
||||
Type[] declaredExceptionTypes, Set<String> alreadyDocumented,
|
||||
TagletWriter writer) {
|
||||
TagletOutput result = writer.getOutputInstance();
|
||||
Content result = writer.getOutputInstance();
|
||||
//Add links to the exceptions declared but not documented.
|
||||
for (int i = 0; i < declaredExceptionTypes.length; i++) {
|
||||
if (declaredExceptionTypes[i].asClassDoc() != null &&
|
||||
@ -95,9 +96,9 @@ public class ThrowsTaglet extends BaseExecutableMemberTaglet
|
||||
! alreadyDocumented.contains(
|
||||
declaredExceptionTypes[i].asClassDoc().qualifiedName())) {
|
||||
if (alreadyDocumented.size() == 0) {
|
||||
result.appendOutput(writer.getThrowsHeader());
|
||||
result.addContent(writer.getThrowsHeader());
|
||||
}
|
||||
result.appendOutput(writer.throwsTagOutput(declaredExceptionTypes[i]));
|
||||
result.addContent(writer.throwsTagOutput(declaredExceptionTypes[i]));
|
||||
alreadyDocumented.add(declaredExceptionTypes[i].asClassDoc().name());
|
||||
}
|
||||
}
|
||||
@ -108,10 +109,10 @@ public class ThrowsTaglet extends BaseExecutableMemberTaglet
|
||||
* Inherit throws documentation for exceptions that were declared but not
|
||||
* documented.
|
||||
*/
|
||||
private TagletOutput inheritThrowsDocumentation(Doc holder,
|
||||
private Content inheritThrowsDocumentation(Doc holder,
|
||||
Type[] declaredExceptionTypes, Set<String> alreadyDocumented,
|
||||
TagletWriter writer) {
|
||||
TagletOutput result = writer.getOutputInstance();
|
||||
Content result = writer.getOutputInstance();
|
||||
if (holder instanceof MethodDoc) {
|
||||
Set<Tag> declaredExceptionTags = new LinkedHashSet<Tag>();
|
||||
for (int j = 0; j < declaredExceptionTypes.length; j++) {
|
||||
@ -125,7 +126,7 @@ public class ThrowsTaglet extends BaseExecutableMemberTaglet
|
||||
}
|
||||
declaredExceptionTags.addAll(inheritedDoc.tagList);
|
||||
}
|
||||
result.appendOutput(throwsTagsOutput(
|
||||
result.addContent(throwsTagsOutput(
|
||||
declaredExceptionTags.toArray(new ThrowsTag[] {}),
|
||||
writer, alreadyDocumented, false));
|
||||
}
|
||||
@ -135,18 +136,18 @@ public class ThrowsTaglet extends BaseExecutableMemberTaglet
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public TagletOutput getTagletOutput(Doc holder, TagletWriter writer) {
|
||||
public Content getTagletOutput(Doc holder, TagletWriter writer) {
|
||||
ExecutableMemberDoc execHolder = (ExecutableMemberDoc) holder;
|
||||
ThrowsTag[] tags = execHolder.throwsTags();
|
||||
TagletOutput result = writer.getOutputInstance();
|
||||
Content result = writer.getOutputInstance();
|
||||
HashSet<String> alreadyDocumented = new HashSet<String>();
|
||||
if (tags.length > 0) {
|
||||
result.appendOutput(throwsTagsOutput(
|
||||
result.addContent(throwsTagsOutput(
|
||||
execHolder.throwsTags(), writer, alreadyDocumented, true));
|
||||
}
|
||||
result.appendOutput(inheritThrowsDocumentation(holder,
|
||||
result.addContent(inheritThrowsDocumentation(holder,
|
||||
execHolder.thrownExceptionTypes(), alreadyDocumented, writer));
|
||||
result.appendOutput(linkToUndocumentedDeclaredExceptions(
|
||||
result.addContent(linkToUndocumentedDeclaredExceptions(
|
||||
execHolder.thrownExceptionTypes(), alreadyDocumented, writer));
|
||||
return result;
|
||||
}
|
||||
@ -160,11 +161,11 @@ public class ThrowsTaglet extends BaseExecutableMemberTaglet
|
||||
* @param alreadyDocumented the set of exceptions that have already
|
||||
* been documented.
|
||||
* @param allowDups True if we allow duplicate throws tags to be documented.
|
||||
* @return the TagletOutput representation of this <code>Tag</code>.
|
||||
* @return the Content representation of this <code>Tag</code>.
|
||||
*/
|
||||
protected TagletOutput throwsTagsOutput(ThrowsTag[] throwTags,
|
||||
protected Content throwsTagsOutput(ThrowsTag[] throwTags,
|
||||
TagletWriter writer, Set<String> alreadyDocumented, boolean allowDups) {
|
||||
TagletOutput result = writer.getOutputInstance();
|
||||
Content result = writer.getOutputInstance();
|
||||
if (throwTags.length > 0) {
|
||||
for (int i = 0; i < throwTags.length; ++i) {
|
||||
ThrowsTag tt = throwTags[i];
|
||||
@ -174,9 +175,9 @@ public class ThrowsTaglet extends BaseExecutableMemberTaglet
|
||||
continue;
|
||||
}
|
||||
if (alreadyDocumented.size() == 0) {
|
||||
result.appendOutput(writer.getThrowsHeader());
|
||||
result.addContent(writer.getThrowsHeader());
|
||||
}
|
||||
result.appendOutput(writer.throwsTagOutput(tt));
|
||||
result.addContent(writer.throwsTagOutput(tt));
|
||||
alreadyDocumented.add(cd != null ?
|
||||
cd.qualifiedName() : tt.exceptionName());
|
||||
}
|
||||
|
||||
@ -28,8 +28,8 @@ package com.sun.tools.doclets.internal.toolkit.taglets;
|
||||
import java.util.*;
|
||||
|
||||
import com.sun.javadoc.*;
|
||||
import com.sun.tools.doclets.formats.html.markup.StringContent;
|
||||
import com.sun.tools.doclets.internal.toolkit.Configuration;
|
||||
import com.sun.tools.doclets.internal.toolkit.Content;
|
||||
import com.sun.tools.doclets.internal.toolkit.util.*;
|
||||
|
||||
/**
|
||||
@ -161,7 +161,7 @@ public class ValueTaglet extends BaseInlineTaglet {
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public TagletOutput getTagletOutput(Tag tag, TagletWriter writer) {
|
||||
public Content getTagletOutput(Tag tag, TagletWriter writer) {
|
||||
FieldDoc field = getFieldDoc(
|
||||
writer.configuration(), tag, tag.text());
|
||||
if (field == null) {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 2007, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2001, 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
|
||||
@ -55,7 +55,7 @@ public class BoldTaglet extends BaseInlineTaglet {
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public TagletOutput getTagletOutput(Tag tag, TagletWriter writer) {
|
||||
public Content getTagletOutput(Tag tag, TagletWriter writer) {
|
||||
ArrayList inlineTags = new ArrayList();
|
||||
inlineTags.add(new TextTag(tag.holder(), "<b>"));
|
||||
inlineTags.addAll(Arrays.asList(tag.inlineTags()));
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 2007, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2001, 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
|
||||
@ -57,7 +57,7 @@ public class GreenTaglet extends BaseInlineTaglet {
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public TagletOutput getTagletOutput(Tag tag, TagletWriter writer) {
|
||||
public Content getTagletOutput(Tag tag, TagletWriter writer) {
|
||||
ArrayList inlineTags = new ArrayList();
|
||||
inlineTags.add(new TextTag(tag.holder(), "<font color=\"green\">"));
|
||||
inlineTags.addAll(Arrays.asList(tag.inlineTags()));
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 2007, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2001, 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
|
||||
@ -57,7 +57,7 @@ public class UnderlineTaglet extends BaseInlineTaglet {
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public TagletOutput getTagletOutput(Tag tag, TagletWriter writer) {
|
||||
public Content getTagletOutput(Tag tag, TagletWriter writer) {
|
||||
ArrayList inlineTags = new ArrayList();
|
||||
inlineTags.add(new TextTag(tag.holder(), "<u>"));
|
||||
inlineTags.addAll(Arrays.asList(tag.inlineTags()));
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 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
|
||||
@ -48,7 +48,7 @@ public class Foo extends BaseTaglet {
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public TagletOutput getTagletOutput(Tag tag, TagletWriter writer) {
|
||||
public Content getTagletOutput(Tag tag, TagletWriter writer) {
|
||||
ArrayList inlineTags = new ArrayList();
|
||||
inlineTags.add(new TextTag(tag.holder(), "<dt><span class=\"strong\">Foo:</span></dt><dd>"));
|
||||
inlineTags.addAll(Arrays.asList(tag.inlineTags()));
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user