本文整理汇总了Java中com.sun.tools.doclets.internal.toolkit.Content类的典型用法代码示例。如果您正苦于以下问题:Java Content类的具体用法?Java Content怎么用?Java Content使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Content类属于com.sun.tools.doclets.internal.toolkit包,在下文中一共展示了Content类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getTagletOutput
import com.sun.tools.doclets.internal.toolkit.Content; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
public Content getTagletOutput(Doc holder, TagletWriter writer) {
Type returnType = ((MethodDoc) holder).returnType();
Tag[] tags = holder.tags(name);
//Make sure we are not using @return tag on method with void return type.
if (returnType.isPrimitive() && returnType.typeName().equals("void")) {
if (tags.length > 0) {
writer.getMsgRetriever().warning(holder.position(),
"doclet.Return_tag_on_void_method");
}
return null;
}
//Inherit @return tag if necessary.
if (tags.length == 0) {
DocFinder.Output inheritedDoc =
DocFinder.search(new DocFinder.Input((MethodDoc) holder, this));
tags = inheritedDoc.holderTag == null ? tags : new Tag[] {inheritedDoc.holderTag};
}
return tags.length > 0 ? writer.returnTagOutput(tags[0]) : null;
}
示例2: getTagletOutput
import com.sun.tools.doclets.internal.toolkit.Content; //导入依赖的package包/类
/**
* Given an array of <code>ParamTag</code>s,return its string representation.
* Try to inherit the param tags that are missing.
*
* @param holder the doc that holds the param tags.
* @param writer the TagletWriter that will write this tag.
* @param formalParameters The array of parmeters (from type or executable
* member) to check.
*
* @return the TagletOutput representation of these <code>ParamTag</code>s.
*/
private Content getTagletOutput(boolean isNonTypeParams, Doc holder,
TagletWriter writer, Object[] formalParameters, ParamTag[] paramTags) {
Content result = writer.getOutputInstance();
Set<String> alreadyDocumented = new HashSet<String>();
if (paramTags.length > 0) {
result.addContent(
processParamTags(isNonTypeParams, paramTags,
getRankMap(formalParameters), writer, alreadyDocumented)
);
}
if (alreadyDocumented.size() != formalParameters.length) {
//Some parameters are missing corresponding @param tags.
//Try to inherit them.
result.addContent(getInheritedTagletOutput (isNonTypeParams, holder,
writer, formalParameters, alreadyDocumented));
}
return result;
}
示例3: getTagletOutput
import com.sun.tools.doclets.internal.toolkit.Content; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
public Content getTagletOutput(Tag tag, TagletWriter writer) {
FieldDoc field = getFieldDoc(
writer.configuration(), tag, tag.text());
if (field == null) {
if (tag.text().isEmpty()) {
//Invalid use of @value
writer.getMsgRetriever().warning(tag.holder().position(),
"doclet.value_tag_invalid_use");
} else {
//Reference is unknown.
writer.getMsgRetriever().warning(tag.holder().position(),
"doclet.value_tag_invalid_reference", tag.text());
}
} else if (field.constantValue() != null) {
return writer.valueTagOutput(field,
field.constantValueExpression(),
! field.equals(tag.holder()));
} else {
//Referenced field is not a constant.
writer.getMsgRetriever().warning(tag.holder().position(),
"doclet.value_tag_invalid_constant", field.name());
}
return writer.getOutputInstance();
}
示例4: linkToUndocumentedDeclaredExceptions
import com.sun.tools.doclets.internal.toolkit.Content; //导入依赖的package包/类
/**
* Add links for exceptions that are declared but not documented.
*/
private Content linkToUndocumentedDeclaredExceptions(
Type[] declaredExceptionTypes, Set<String> alreadyDocumented,
TagletWriter writer) {
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 &&
! alreadyDocumented.contains(
declaredExceptionTypes[i].asClassDoc().name()) &&
! alreadyDocumented.contains(
declaredExceptionTypes[i].asClassDoc().qualifiedName())) {
if (alreadyDocumented.size() == 0) {
result.addContent(writer.getThrowsHeader());
}
result.addContent(writer.throwsTagOutput(declaredExceptionTypes[i]));
alreadyDocumented.add(declaredExceptionTypes[i].asClassDoc().name());
}
}
return result;
}
示例5: inheritThrowsDocumentation
import com.sun.tools.doclets.internal.toolkit.Content; //导入依赖的package包/类
/**
* Inherit throws documentation for exceptions that were declared but not
* documented.
*/
private Content inheritThrowsDocumentation(Doc holder,
Type[] declaredExceptionTypes, Set<String> alreadyDocumented,
TagletWriter writer) {
Content result = writer.getOutputInstance();
if (holder instanceof MethodDoc) {
Set<Tag> declaredExceptionTags = new LinkedHashSet<Tag>();
for (int j = 0; j < declaredExceptionTypes.length; j++) {
DocFinder.Output inheritedDoc =
DocFinder.search(new DocFinder.Input((MethodDoc) holder, this,
declaredExceptionTypes[j].typeName()));
if (inheritedDoc.tagList.size() == 0) {
inheritedDoc = DocFinder.search(new DocFinder.Input(
(MethodDoc) holder, this,
declaredExceptionTypes[j].qualifiedTypeName()));
}
declaredExceptionTags.addAll(inheritedDoc.tagList);
}
result.addContent(throwsTagsOutput(
declaredExceptionTags.toArray(new ThrowsTag[] {}),
writer, alreadyDocumented, false));
}
return result;
}
示例6: getTagletOutput
import com.sun.tools.doclets.internal.toolkit.Content; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
public Content getTagletOutput(Doc holder, TagletWriter writer) {
ExecutableMemberDoc execHolder = (ExecutableMemberDoc) holder;
ThrowsTag[] tags = execHolder.throwsTags();
Content result = writer.getOutputInstance();
HashSet<String> alreadyDocumented = new HashSet<String>();
if (tags.length > 0) {
result.addContent(throwsTagsOutput(
execHolder.throwsTags(), writer, alreadyDocumented, true));
}
result.addContent(inheritThrowsDocumentation(holder,
execHolder.thrownExceptionTypes(), alreadyDocumented, writer));
result.addContent(linkToUndocumentedDeclaredExceptions(
execHolder.thrownExceptionTypes(), alreadyDocumented, writer));
return result;
}
示例7: throwsTagsOutput
import com.sun.tools.doclets.internal.toolkit.Content; //导入依赖的package包/类
/**
* Given an array of <code>Tag</code>s representing this custom
* tag, return its string representation.
* @param throwTags the array of <code>ThrowsTag</code>s to convert.
* @param writer the TagletWriter that will write this tag.
* @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 Content representation of this <code>Tag</code>.
*/
protected Content throwsTagsOutput(ThrowsTag[] throwTags,
TagletWriter writer, Set<String> alreadyDocumented, boolean allowDups) {
Content result = writer.getOutputInstance();
if (throwTags.length > 0) {
for (int i = 0; i < throwTags.length; ++i) {
ThrowsTag tt = throwTags[i];
ClassDoc cd = tt.exception();
if ((!allowDups) && (alreadyDocumented.contains(tt.exceptionName()) ||
(cd != null && alreadyDocumented.contains(cd.qualifiedName())))) {
continue;
}
if (alreadyDocumented.size() == 0) {
result.addContent(writer.getThrowsHeader());
}
result.addContent(writer.throwsTagOutput(tt));
alreadyDocumented.add(cd != null ?
cd.qualifiedName() : tt.exceptionName());
}
}
return result;
}
示例8: inheritThrowsDocumentation
import com.sun.tools.doclets.internal.toolkit.Content; //导入依赖的package包/类
/**
* Inherit throws documentation for exceptions that were declared but not
* documented.
*/
private Content inheritThrowsDocumentation(Doc holder,
Type[] declaredExceptionTypes, Set<String> alreadyDocumented,
TagletWriter writer) {
Content result = writer.getOutputInstance();
if (holder instanceof MethodDoc) {
Set<Tag> declaredExceptionTags = new LinkedHashSet<>();
for (Type declaredExceptionType : declaredExceptionTypes) {
DocFinder.Output inheritedDoc =
DocFinder.search(writer.configuration(), new DocFinder.Input((MethodDoc) holder, this,
declaredExceptionType.typeName()));
if (inheritedDoc.tagList.size() == 0) {
inheritedDoc = DocFinder.search(writer.configuration(), new DocFinder.Input(
(MethodDoc) holder, this,
declaredExceptionType.qualifiedTypeName()));
}
declaredExceptionTags.addAll(inheritedDoc.tagList);
}
result.addContent(throwsTagsOutput(
declaredExceptionTags.toArray(new ThrowsTag[] {}),
writer, alreadyDocumented, false));
}
return result;
}
示例9: addContent
import com.sun.tools.doclets.internal.toolkit.Content; //导入依赖的package包/类
/**
* Adds content for the HTML tag.
*
* @param tagContent tag content to be added
*/
public void addContent(Content tagContent) {
if (tagContent instanceof ContentBuilder) {
for (Content content: ((ContentBuilder)tagContent).contents) {
addContent(content);
}
}
else if (tagContent == HtmlTree.EMPTY || tagContent.isValid()) {
if (content.isEmpty())
content = new ArrayList<Content>();
content.add(tagContent);
}
}
示例10: write
import com.sun.tools.doclets.internal.toolkit.Content; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public boolean write(Writer out, boolean atNewline) throws IOException {
if (!isInline() && !atNewline)
out.write(DocletConstants.NL);
String tagString = htmlTag.toString();
out.write("<");
out.write(tagString);
Iterator<HtmlAttr> iterator = attrs.keySet().iterator();
HtmlAttr key;
String value;
while (iterator.hasNext()) {
key = iterator.next();
value = attrs.get(key);
out.write(" ");
out.write(key.toString());
if (!value.isEmpty()) {
out.write("=\"");
out.write(value);
out.write("\"");
}
}
out.write(">");
boolean nl = false;
for (Content c : content)
nl = c.write(out, nl);
if (htmlTag.endTagRequired()) {
out.write("</");
out.write(tagString);
out.write(">");
}
if (!isInline()) {
out.write(DocletConstants.NL);
return true;
} else {
return false;
}
}
示例11: stripHtml
import com.sun.tools.doclets.internal.toolkit.Content; //导入依赖的package包/类
/**
* Given a Content node, strips all html characters and
* return the result.
*
* @param body The content node to check.
* @return the plain text from the content node
*
*/
private static String stripHtml(Content body) {
String rawString = body.toString();
// remove HTML tags
rawString = rawString.replaceAll("\\<.*?>", " ");
// consolidate multiple spaces between a word to a single space
rawString = rawString.replaceAll("\\b\\s{2,}\\b", " ");
// remove extra whitespaces
return rawString.trim();
}
示例12: addContent
import com.sun.tools.doclets.internal.toolkit.Content; //导入依赖的package包/类
@Override
public void addContent(Content content) {
nullCheck(content);
ensureMutableContents();
if (content instanceof ContentBuilder) {
contents.addAll(((ContentBuilder) content).contents);
} else
contents.add(content);
}
示例13: write
import com.sun.tools.doclets.internal.toolkit.Content; //导入依赖的package包/类
@Override
public boolean write(Writer writer, boolean atNewline) throws IOException {
for (Content content: contents) {
atNewline = content.write(writer, atNewline);
}
return atNewline;
}
示例14: isEmpty
import com.sun.tools.doclets.internal.toolkit.Content; //导入依赖的package包/类
@Override
public boolean isEmpty() {
for (Content content: contents) {
if (!content.isEmpty())
return false;
}
return true;
}
示例15: charCount
import com.sun.tools.doclets.internal.toolkit.Content; //导入依赖的package包/类
@Override
public int charCount() {
int n = 0;
for (Content c : contents)
n += c.charCount();
return n;
}