本文整理汇总了Java中com.sun.javadoc.ProgramElementDoc类的典型用法代码示例。如果您正苦于以下问题:Java ProgramElementDoc类的具体用法?Java ProgramElementDoc怎么用?Java ProgramElementDoc使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ProgramElementDoc类属于com.sun.javadoc包,在下文中一共展示了ProgramElementDoc类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: exclude
import com.sun.javadoc.ProgramElementDoc; //导入依赖的package包/类
private static boolean exclude(Doc doc) {
// if (doc.name().contains("UnitTest")) {
// return true;
// }
if (doc != null) {
if (doc.tags(EXCLUDE_TAG).length > 0) {
return true;
} else if (doc instanceof ProgramElementDoc) {
if (exclude(((ProgramElementDoc) doc).containingPackage())) {
return true;
} else if (exclude(((ProgramElementDoc) doc).containingClass())) {
return true;
}
}
}
// nothing above found a reason to exclude
return false;
}
示例2: linkedName
import com.sun.javadoc.ProgramElementDoc; //导入依赖的package包/类
/**
* Appends to the current document a link that is
* built from the given ``element``. Such links is
* usually leading to the internal corresponding
* document section
*
* @param element Element to build link from.
*/
public void linkedName(final ProgramElementDoc element) {
final StringBuffer anchorBuilder = new StringBuffer()
.append('#')
.append(element.name());
if (element instanceof ExecutableMemberDoc) {
final ExecutableMemberDoc member = (ExecutableMemberDoc) element;
final Parameter[] parameters = member.parameters();
if (parameters.length == 0) { // Empty constructor case.
}
for (int i = 0; i < parameters.length; i++) {
anchorBuilder.append(parameters[i].type().simpleTypeName());
if (i < parameters.length - 1) {
anchorBuilder.append('-');
}
}
}
final String url = anchorBuilder.toString().toLowerCase();
link(element.name(), url);
}
示例3: start
import com.sun.javadoc.ProgramElementDoc; //导入依赖的package包/类
public static boolean start(final RootDoc root) {
for (final ClassDoc cls : root.classes()) {
final List<ProgramElementDoc> elements = new LinkedList<>();
elements.add(cls);
elements.addAll(Arrays.asList(cls.constructors()));
elements.addAll(Arrays.asList(cls.methods()));
for (final ProgramElementDoc elem : elements) {
for (final Tag tag : elem.inlineTags()) {
final String name = tag.name();
if (name.equals("@code") && tag.text().trim().startsWith(">")) {
generateRunner(cls, elem, tag);
}
}
}
}
return true;
}
示例4: formatModifiers
import com.sun.javadoc.ProgramElementDoc; //导入依赖的package包/类
public String formatModifiers(ProgramElementDoc doc) {
StringBuffer sb = new StringBuffer(32);
if (doc.isPublic()) {
sb.append("public ");
}
if (doc.isPrivate()) {
sb.append("private ");
}
if (doc.isProtected()) {
sb.append("protected ");
}
if (doc.isStatic()) {
sb.append("static ");
}
if (doc.isInterface()) {
sb.append("interface ");
}
if (doc.isFinal()) {
sb.append("final ");
}
if (doc.isClass()) {
sb.append("class ");
}
return (sb.length() == 0) ? "" : color(sb.toString(), "blue");
}
示例5: getLink
import com.sun.javadoc.ProgramElementDoc; //导入依赖的package包/类
public String getLink(ProgramElementDoc doc, int context)
{
ClassDoc cdoc = doc.containingClass();
if (doc instanceof ClassDoc || doc.isInterface() || doc.isEnum() || doc.isError() || doc.isException() || doc.isAnnotationType())
{
cdoc = (ClassDoc) doc;
}
LinkInfoImpl lnInfo = new LinkInfoImpl(context, cdoc, "", null);
if (lnInfo == null)
{
return null;
}
String link = docWriter.getLink(lnInfo);
if (link == null)
{
return null;
}
return getHref(link) + "#" + getSignature(doc);
}
示例6: isProgramElementDocAnnotatedWith
import com.sun.javadoc.ProgramElementDoc; //导入依赖的package包/类
protected boolean isProgramElementDocAnnotatedWith(ProgramElementDoc elementDoc, String annotation) {
AnnotationDesc[] annotations = elementDoc.annotations();
for (int i = 0; i < annotations.length; i++) {
if (annotations[i].annotationType().qualifiedTypeName().equals(annotation)) {
return true;
}
}
return false;
}
示例7: commentText
import com.sun.javadoc.ProgramElementDoc; //导入依赖的package包/类
private static String commentText(ProgramElementDoc doc) {
if (doc instanceof MethodDoc) {
MethodDoc method = (MethodDoc) doc;
return Javadocs.commentText(method).orElse("");
} else return doc.commentText();
}
示例8: getClassName
import com.sun.javadoc.ProgramElementDoc; //导入依赖的package包/类
/**
* Reconstitute the class name from the given class JavaDoc object.
*
* @param doc the Javadoc model for the given class.
* @return The (string) class name of the given class.
*/
protected static String getClassName(ProgramElementDoc doc, boolean binaryName) {
PackageDoc containingPackage = doc.containingPackage();
String className = doc.name();
if (binaryName) {
className = className.replaceAll("\\.", "\\$");
}
return containingPackage.name().length() > 0 ?
String.format("%s.%s", containingPackage.name(), className) :
String.format("%s", className);
}
示例9: writeAccessibility
import com.sun.javadoc.ProgramElementDoc; //导入依赖的package包/类
static IndentingPrintWriter writeAccessibility(IndentingPrintWriter out, ProgramElementDoc element) {
if (element.isStatic()) {
out.append("{static}").whitespace();
}
return element.isPrivate() ? out.append('-')
: element.isProtected() ? out.append('#')
: element.isPackagePrivate() ? out.append('~')
: out.append('+');
}
示例10: annotationNamed
import com.sun.javadoc.ProgramElementDoc; //导入依赖的package包/类
static Optional<AnnotationDesc> annotationNamed(
ProgramElementDoc doc, String annotationName) {
for (AnnotationDesc a : doc.annotations()) {
if (annotationName.equals(a.annotationType().qualifiedTypeName())) {
return Optional.of(a);
}
}
return Optional.absent();
}
示例11: getVisibility
import com.sun.javadoc.ProgramElementDoc; //导入依赖的package包/类
/**
* Sets the visibility for the class, method or field.
*
* @param member The member for which the visibility needs to be set (class, method, or field).
* @param node The node to which the visibility should be set.
*/
private static String getVisibility(ProgramElementDoc member) {
if (member.isPrivate()) return "private";
if (member.isProtected()) return "protected";
if (member.isPublic()) return "public";
if (member.isPackagePrivate()) return "package-private";
// Should never happen
return null;
}
示例12: parseScope
import com.sun.javadoc.ProgramElementDoc; //导入依赖的package包/类
/**
* Returns string representation of scope
*
* @param doc
* @return
*/
protected String parseScope(ProgramElementDoc doc) {
if (doc.isPrivate()) {
return "private";
} else if (doc.isProtected()) {
return "protected";
} else if (doc.isPublic()) {
return "public";
}
return "";
}
示例13: getAnnotationDesc
import com.sun.javadoc.ProgramElementDoc; //导入依赖的package包/类
public static AnnotationDesc getAnnotationDesc(ProgramElementDoc doc, Class<? extends Annotation> annotationClz) {
for (AnnotationDesc annotationDesc : doc.annotations()) {
if (annotationDesc.annotationType()
.qualifiedTypeName().equals(annotationClz.getName())) {
return annotationDesc;
}
}
return null;
}
示例14: returnSignature
import com.sun.javadoc.ProgramElementDoc; //导入依赖的package包/类
/**
* Appends to the current document the ``member``
* returns label, which is composed of the given
* ``member`` modifiers if any, followed by the
* return type link, if the given ``member`` is
* a method,
*
* @param element Member to build return label for.
*/
public void returnSignature(final ProgramElementDoc element) {
code(element.modifiers());
if (element.isMethod()) {
final MethodDoc method = (MethodDoc) element;
character(' ');
// TODO : Consider using source instance instead.
typeLink(method.containingPackage(), method.returnType());
}
}
示例15: rowSignature
import com.sun.javadoc.ProgramElementDoc; //导入依赖的package包/类
/**
* Appends to the current document the signature
* of the given ``member`` as a table row.
*
* @param element Member to write signature from.
*/
public void rowSignature(final ProgramElementDoc element) {
startTableRow();
returnSignature(element);
cell();
linkedName(element);
if (element instanceof ExecutableMemberDoc) {
final ExecutableMemberDoc member = (ExecutableMemberDoc) element;
inlineParameters(member.parameters());
}
endTableRow();
newLine();
}