Java Code Examples for com.sun.javadoc.ClassDoc#name()

The following examples show how to use com.sun.javadoc.ClassDoc#name() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PSItemDoc.java    From PrivacyStreams with Apache License 2.0 6 votes vote down vote up
private PSItemDoc(ClassDoc classDoc) {
    this.classDoc = classDoc;
    this.name = classDoc.name();
    this.description = classDoc.commentText();
    this.itemFieldDocs = new ArrayList<>();
    this.providerDocs = new ArrayList<>();

    List<FieldDoc> allFields = new ArrayList<>();
    this.getAllFieldDocs(classDoc, allFields);

    for (FieldDoc fieldDoc : allFields) {
        PSItemFieldDoc itemFieldDoc = PSItemFieldDoc.build(this, fieldDoc);
        if (itemFieldDoc != null) this.itemFieldDocs.add(itemFieldDoc);
    }

    for (MethodDoc methodDoc : classDoc.methods()) {
        PSOperatorDoc providerDoc = PSOperatorDoc.build(classDoc, methodDoc);
        if (providerDoc != null) this.providerDocs.add(providerDoc);
    }
}
 
Example 2
Source File: AntTaskDoclet.java    From ant-git-tasks with Apache License 2.0 6 votes vote down vote up
private static void registerClassData(ClassDoc doc) {
        ClassData data = new ClassData();

        Scanner sc = new Scanner(doc.commentText());

        data.description = sc.nextLine();
        sc.close();
        data.qualifiedName = doc.qualifiedTypeName();
        data.simpleName = doc.name();
        data.hidden = doc.isAbstract();
        data.parentClassDatas.addAll(collectParentClassesNames(doc));

        for (MethodDoc methodDoc : doc.methods()) {
                if (!isHiddenMethodDoc(methodDoc)) {
                        if (isTaskAttribute(methodDoc)) {
                                data.attributesList.add(AttributeData.fromMethodDoc(methodDoc));
                        } else if (isTaskElement(methodDoc)) {
                                data.elementsList.add(ElementData.fromMethodDoc(methodDoc));
                        }
                }
        }

        classDataMap.put(data.qualifiedName, data);
}
 
Example 3
Source File: PSOperatorDoc.java    From PrivacyStreams with Apache License 2.0 5 votes vote down vote up
private PSOperatorDoc(ClassDoc classDoc, MethodDoc methodDoc) {
        this.declaringClassDoc = classDoc;
        this.methodDoc = methodDoc;
        this.description = methodDoc.commentText().replace('\n', ' ');
        this.paramDesc = "";

        Tag[] paramTags = methodDoc.tags("param");
        for (Tag paramTag : paramTags) {
            String paraStr = paramTag.text();
            String paraName = paraStr.substring(0, paraStr.indexOf(' ')).replace('\n', ' ');;
            String paraDesc = paraStr.substring(paraStr.indexOf(' ') + 1).replace('\n', ' ');;
            this.paramDesc += "<br> - `" + paraName + "`: " + paraDesc;
        }

        this.returnType = methodDoc.returnType();
//        ParameterizedType returnType = methodDoc.returnType().asParameterizedType();
//        this.inputType = returnType.typeArguments()[0];
//        this.outputType = returnType.typeArguments()[1];
//        this.completeSignature = "Function<" + this.inputType + ", " + this.outputType + "> " + methodDoc.toString();

        String shortSignature = classDoc.name() + "." + methodDoc.name() + "(";
        boolean firstParameter = true;
        for (Parameter parameter : methodDoc.parameters()) {
            if (firstParameter) {
                shortSignature += Utils.getSimpleTypeName(parameter.type()) + " " + parameter.name();
                firstParameter = false;
            } else {
                shortSignature += ", " + Utils.getSimpleTypeName(parameter.type()) + " " + parameter.name();
            }
        }
        shortSignature += ")";
        this.shortSignature = shortSignature;
    }
 
Example 4
Source File: PSOperatorWrapperDoc.java    From PrivacyStreams with Apache License 2.0 5 votes vote down vote up
private PSOperatorWrapperDoc(ClassDoc classDoc) {
    this.classDoc = classDoc;
    this.name = classDoc.name();
    this.description = classDoc.commentText();
    this.operatorDocs = new ArrayList<>();

    for (MethodDoc methodDoc : classDoc.methods()) {
        PSOperatorDoc operatorDoc = PSOperatorDoc.build(classDoc, methodDoc);
        if (operatorDoc != null) this.operatorDocs.add(operatorDoc);
    }
}
 
Example 5
Source File: Utils.java    From PrivacyStreams with Apache License 2.0 5 votes vote down vote up
public static boolean instanceOf(ClassDoc classDoc, String superClassName) {
        if (classDoc == null || superClassName == null) return false;
        String className = classDoc.containingPackage().name() + "." + classDoc.name();
//        System.out.println(className + " " + superClassName);
        if (className.startsWith(superClassName)) {
            return true;
        }
        return instanceOf(classDoc.superclass(), superClassName);
    }
 
Example 6
Source File: FlowDocumentation.java    From nomulus with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a FlowDocumentation for this flow class using data from javadoc tags.  Not public
 * because clients should get FlowDocumentation objects via the DocumentationGenerator class.
 */
protected FlowDocumentation(ClassDoc flowDoc) {
  name = flowDoc.name();
  qualifiedName = flowDoc.qualifiedName();
  packageName = flowDoc.containingPackage().name();
  classDocs = flowDoc.commentText();
  errors = new ArrayList<>();
  // Store error codes in sorted order, and leave reasons in insert order.
  errorsByCode =
      Multimaps.newListMultimap(new TreeMap<Long, Collection<ErrorCase>>(), ArrayList::new);
  parseTags(flowDoc);
}
 
Example 7
Source File: FlowDocumentation.java    From nomulus with Apache License 2.0 5 votes vote down vote up
/** Constructs an ErrorCase from the corresponding class for a low-level flow exception. */
protected ErrorCase(ClassDoc exceptionDoc) {
  name = exceptionDoc.name();
  className = exceptionDoc.qualifiedName();
  // The javadoc comment on the class explains the reason for the error condition.
  reason = exceptionDoc.commentText();
  ClassDoc highLevelExceptionDoc = getHighLevelExceptionFrom(exceptionDoc);
  errorCode = extractErrorCode(highLevelExceptionDoc);
  checkArgument(!exceptionDoc.isAbstract(),
      "Cannot use an abstract subclass of EppException as an error case");
}
 
Example 8
Source File: SarlClassWriter.java    From sarl with Apache License 2.0 5 votes vote down vote up
@Override
public Content getHeader(String header) {
	final ClassDoc doc = getClassDoc();
	if (doc != null) {
		final Integer sarlType = Utils.getSarlClassification(doc);
		if (sarlType != null) {
			final String label;
			switch (sarlType.intValue()) {
			case SARLFeatureAccess.SARL_AGENT:
				label = this.configuration.standardmessage.getText(SarlMessageRetreiver.DOCLET_AGENT);
				break;
			case SARLFeatureAccess.SARL_EVENT:
				label = this.configuration.standardmessage.getText(SarlMessageRetreiver.DOCLET_EVENT);
				break;
			case SARLFeatureAccess.SARL_BEHAVIOR:
				label = this.configuration.standardmessage.getText(SarlMessageRetreiver.DOCLET_BEHAVIOR);
				break;
			case SARLFeatureAccess.SARL_CAPACITY:
				label = this.configuration.standardmessage.getText(SarlMessageRetreiver.DOCLET_CAPACITY);
				break;
			case SARLFeatureAccess.SARL_SKILL:
				label = this.configuration.standardmessage.getText(SarlMessageRetreiver.DOCLET_SKILL);
				break;
			case SARLFeatureAccess.SARL_SPACE:
				label = this.configuration.standardmessage.getText(SarlMessageRetreiver.DOCLET_SPACE);
				break;
			case SARLFeatureAccess.SARL_ARTIFACT:
				label = this.configuration.standardmessage.getText(SarlMessageRetreiver.DOCLET_ARTIFACT);
				break;
			default:
				label = null;
			}
			if (!Utils.isNullOrEmpty(label)) {
				return super.getHeader(label + " " + doc.name()); //$NON-NLS-1$
			}
		}
	}
	return super.getHeader(header);
}
 
Example 9
Source File: DocPath.java    From TencentKona-8 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Return the path for the simple name of the class.
 * For example, if the class is java.lang.Object,
 * the path is Object.html.
 */
public static DocPath forName(ClassDoc cd) {
    return (cd == null) ? empty : new DocPath(cd.name() + ".html");
}
 
Example 10
Source File: DocPath.java    From jdk8u60 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Return the path for the simple name of the class.
 * For example, if the class is java.lang.Object,
 * the path is Object.html.
 */
public static DocPath forName(ClassDoc cd) {
    return (cd == null) ? empty : new DocPath(cd.name() + ".html");
}
 
Example 11
Source File: DocPath.java    From openjdk-jdk8u with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Return the path for the simple name of the class.
 * For example, if the class is java.lang.Object,
 * the path is Object.html.
 */
public static DocPath forName(ClassDoc cd) {
    return (cd == null) ? empty : new DocPath(cd.name() + ".html");
}
 
Example 12
Source File: DocPath.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Return the path for the simple name of the class.
 * For example, if the class is java.lang.Object,
 * the path is Object.html.
 */
public static DocPath forName(ClassDoc cd) {
    return (cd == null) ? empty : new DocPath(cd.name() + ".html");
}
 
Example 13
Source File: DocPath.java    From openjdk-jdk9 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Return the path for the simple name of the class.
 * For example, if the class is java.lang.Object,
 * the path is Object.html.
 */
public static DocPath forName(ClassDoc cd) {
    return (cd == null) ? empty : new DocPath(cd.name() + ".html");
}
 
Example 14
Source File: DocPath.java    From hottub with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Return the path for the simple name of the class.
 * For example, if the class is java.lang.Object,
 * the path is Object.html.
 */
public static DocPath forName(ClassDoc cd) {
    return (cd == null) ? empty : new DocPath(cd.name() + ".html");
}
 
Example 15
Source File: DocPath.java    From openjdk-8-source with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Return the path for the simple name of the class.
 * For example, if the class is java.lang.Object,
 * the path is Object.html.
 */
public static DocPath forName(ClassDoc cd) {
    return (cd == null) ? empty : new DocPath(cd.name() + ".html");
}
 
Example 16
Source File: DocPath.java    From openjdk-8 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Return the path for the simple name of the class.
 * For example, if the class is java.lang.Object,
 * the path is Object.html.
 */
public static DocPath forName(ClassDoc cd) {
    return (cd == null) ? empty : new DocPath(cd.name() + ".html");
}