当前位置: 首页>>代码示例>>Java>>正文


Java Content.addContent方法代码示例

本文整理汇总了Java中com.sun.tools.doclets.internal.toolkit.Content.addContent方法的典型用法代码示例。如果您正苦于以下问题:Java Content.addContent方法的具体用法?Java Content.addContent怎么用?Java Content.addContent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.sun.tools.doclets.internal.toolkit.Content的用法示例。


在下文中一共展示了Content.addContent方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: 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;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:30,代码来源:ParamTaglet.java

示例2: 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;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:24,代码来源:ThrowsTaglet.java

示例3: 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;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:28,代码来源:ThrowsTaglet.java

示例4: 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;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:19,代码来源:ThrowsTaglet.java

示例5: 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;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:32,代码来源:ThrowsTaglet.java

示例6: 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<>();
    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;
}
 
开发者ID:campolake,项目名称:openjdk9,代码行数:30,代码来源:ParamTaglet.java

示例7: 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 (Type declaredExceptionType : declaredExceptionTypes) {
        if (declaredExceptionType.asClassDoc() != null &&
            !alreadyDocumented.contains(
                    declaredExceptionType.asClassDoc().name()) &&
            !alreadyDocumented.contains(
                    declaredExceptionType.asClassDoc().qualifiedName())) {
            if (alreadyDocumented.size() == 0) {
                result.addContent(writer.getThrowsHeader());
            }
            result.addContent(writer.throwsTagOutput(declaredExceptionType));
            alreadyDocumented.add(declaredExceptionType.asClassDoc().name());
        }
    }
    return result;
}
 
开发者ID:campolake,项目名称:openjdk9,代码行数:24,代码来源:ThrowsTaglet.java

示例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;
}
 
开发者ID:campolake,项目名称:openjdk9,代码行数:28,代码来源:ThrowsTaglet.java

示例9: 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<>();
    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;
}
 
开发者ID:campolake,项目名称:openjdk9,代码行数:19,代码来源:ThrowsTaglet.java

示例10: 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 (ThrowsTag tt : throwTags) {
            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;
}
 
开发者ID:campolake,项目名称:openjdk9,代码行数:31,代码来源:ThrowsTaglet.java

示例11: addContent

import com.sun.tools.doclets.internal.toolkit.Content; //导入方法依赖的package包/类
/**
 * This method adds a string content to the htmltree. If the last content member
 * added is a StringContent, append the string to that StringContent or else
 * create a new StringContent and add it to the html tree.
 *
 * @param stringContent string content that needs to be added
 */
public void addContent(String stringContent) {
    if (!content.isEmpty()) {
        Content lastContent = content.get(content.size() - 1);
        if (lastContent instanceof StringContent)
            lastContent.addContent(stringContent);
        else
            addContent(new StringContent(stringContent));
    }
    else
        addContent(new StringContent(stringContent));
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:19,代码来源:HtmlTree.java

示例12: getInheritedTagletOutput

import com.sun.tools.doclets.internal.toolkit.Content; //导入方法依赖的package包/类
/**
 * Loop through each indivitual parameter.  It it does not have a
 * corresponding param tag, try to inherit it.
 */
private Content getInheritedTagletOutput(boolean isNonTypeParams, Doc holder,
        TagletWriter writer, Object[] formalParameters,
        Set<String> alreadyDocumented) {
    Content result = writer.getOutputInstance();
    if ((! alreadyDocumented.contains(null)) &&
            holder instanceof MethodDoc) {
        for (int i = 0; i < formalParameters.length; i++) {
            if (alreadyDocumented.contains(String.valueOf(i))) {
                continue;
            }
            //This parameter does not have any @param documentation.
            //Try to inherit it.
            DocFinder.Output inheritedDoc =
                DocFinder.search(new DocFinder.Input((MethodDoc) holder, this,
                    String.valueOf(i), ! isNonTypeParams));
            if (inheritedDoc.inlineTags != null &&
                    inheritedDoc.inlineTags.length > 0) {
                result.addContent(
                    processParamTag(isNonTypeParams, writer,
                        (ParamTag) inheritedDoc.holderTag,
                        isNonTypeParams ?
                            ((Parameter) formalParameters[i]).name():
                            ((TypeVariable) formalParameters[i]).typeName(),
                        alreadyDocumented.size() == 0));
            }
            alreadyDocumented.add(String.valueOf(i));
        }
    }
    return result;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:35,代码来源:ParamTaglet.java

示例13: processParamTags

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.  Print a warning for param
 * tags that do not map to parameters.  Print a warning for param
 * tags that are duplicated.
 *
 * @param paramTags the array of <code>ParamTag</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 rankMap a {@link java.util.Map} which holds ordering
 *                    information about the parameters.
 * @param rankMap a {@link java.util.Map} which holds a mapping
 *                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 Content representation of this <code>Tag</code>.
 */
private Content processParamTags(boolean isNonTypeParams,
        ParamTag[] paramTags, Map<String, String> rankMap, TagletWriter writer,
        Set<String> alreadyDocumented) {
    Content result = writer.getOutputInstance();
    if (paramTags.length > 0) {
        for (int i = 0; i < paramTags.length; ++i) {
            ParamTag pt = paramTags[i];
            String paramName = isNonTypeParams ?
                pt.parameterName() : "<" + pt.parameterName() + ">";
            if (! rankMap.containsKey(pt.parameterName())) {
                writer.getMsgRetriever().warning(pt.position(),
                    isNonTypeParams ?
                        "doclet.Parameters_warn" :
                        "doclet.Type_Parameters_warn",
                    paramName);
            }
            String rank = rankMap.get(pt.parameterName());
            if (rank != null && alreadyDocumented.contains(rank)) {
                writer.getMsgRetriever().warning(pt.position(),
                   isNonTypeParams ?
                       "doclet.Parameters_dup_warn" :
                       "doclet.Type_Parameters_dup_warn",
                   paramName);
            }
            result.addContent(processParamTag(isNonTypeParams, writer, pt,
                 pt.parameterName(), alreadyDocumented.size() == 0));
            alreadyDocumented.add(rank);
        }
    }
    return result;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:50,代码来源:ParamTaglet.java

示例14: processParamTag

import com.sun.tools.doclets.internal.toolkit.Content; //导入方法依赖的package包/类
/**
 * 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.
 * @param writer          the taglet writer for output writing.
 * @param paramTag        the tag whose inline tags will be printed.
 * @param name            the name of the parameter.  We can't rely on
 *                        the name in the param tag because we might be
 *                        inheriting documentation.
 * @param isFirstParam    true if this is the first param tag being printed.
 *
 */
private Content processParamTag(boolean isNonTypeParams,
        TagletWriter writer, ParamTag paramTag, String name,
        boolean isFirstParam) {
    Content result = writer.getOutputInstance();
    String header = writer.configuration().getText(
        isNonTypeParams ? "doclet.Parameters" : "doclet.TypeParameters");
    if (isFirstParam) {
        result.addContent(writer.getParamHeader(header));
    }
    result.addContent(writer.paramTagOutput(paramTag,
        name));
    return result;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:27,代码来源:ParamTaglet.java

示例15: getTagletOutput

import com.sun.tools.doclets.internal.toolkit.Content; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
public Content getTagletOutput(Tag tag, TagletWriter writer)
        throws IllegalArgumentException {
    Content output = writer.getOutputInstance();
    output.addContent(new RawHtml(legacyTaglet.toString(tag)));
    return output;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:10,代码来源:LegacyTaglet.java


注:本文中的com.sun.tools.doclets.internal.toolkit.Content.addContent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。