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

The following examples show how to use com.sun.javadoc.ClassDoc#annotations() . 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: SwaggerPropertiesDoclet.java    From springfox-javadoc with Apache License 2.0 6 votes vote down vote up
private static String processClass(
  ClassDoc classDoc,
  StringBuilder pathRoot) {

    String defaultRequestMethod = null;
    for (AnnotationDesc annotationDesc : classDoc.annotations()) {
        if (REQUEST_MAPPING.equals(annotationDesc.annotationType().qualifiedTypeName())) {
            for (AnnotationDesc.ElementValuePair pair : annotationDesc.elementValues()) {

                if (VALUE.equals(pair.element().name()) || PATH.equals(pair.element().name())) {
                    setRoot(pathRoot, pair);
                }
                if (METHOD.equals(pair.element().name())) {
                    defaultRequestMethod = pair.value().toString();
                }
            }
            break;
        }
    }
    return defaultRequestMethod;
}
 
Example 2
Source File: Main.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public static boolean start(RootDoc root) {
    for (ClassDoc d : root.classes()) {
        for (AnnotationDesc a : d.annotations()) {
            System.out.println(a.annotationType());
        }
    }
    return true;
}
 
Example 3
Source File: Main.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public static boolean start(RootDoc root) {
    for (ClassDoc d : root.classes()) {
        for (AnnotationDesc a : d.annotations()) {
            System.out.println(a.annotationType());
        }
    }
    return true;
}
 
Example 4
Source File: Main.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public static boolean start(RootDoc root) {
    for (ClassDoc d : root.classes()) {
        for (AnnotationDesc a : d.annotations()) {
            System.out.println(a.annotationType());
        }
    }
    return true;
}
 
Example 5
Source File: PSOperatorWrapperDoc.java    From PrivacyStreams with Apache License 2.0 5 votes vote down vote up
public static PSOperatorWrapperDoc build(ClassDoc classDoc) {
    AnnotationDesc[] annotations = classDoc.annotations();
    for (AnnotationDesc annotation : annotations) {
        AnnotationTypeDoc annotationType = annotation.annotationType();
        if (Consts.OPERATOR_WRAPPER_ANNOTATION.equals(annotationType.toString())) {
            return new PSOperatorWrapperDoc(classDoc);
        }
    }
    return null;
}
 
Example 6
Source File: PSItemDoc.java    From PrivacyStreams with Apache License 2.0 5 votes vote down vote up
public static boolean isValidPSItem(ClassDoc classDoc) {
    AnnotationDesc[] annotations = classDoc.annotations();
    for (AnnotationDesc annotation : annotations) {
        AnnotationTypeDoc annotationType = annotation.annotationType();
        if (Consts.ITEM_ANNOTATION.equals(annotationType.toString())) {
            return true;
        }
    }
    return false;
}
 
Example 7
Source File: Main.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public static boolean start(RootDoc root) {
    for (ClassDoc d : root.classes()) {
        for (AnnotationDesc a : d.annotations()) {
            System.out.println(a.annotationType());
        }
    }
    return true;
}
 
Example 8
Source File: Main.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public static boolean start(RootDoc root) {
    for (ClassDoc d : root.classes()) {
        for (AnnotationDesc a : d.annotations()) {
            System.out.println(a.annotationType());
        }
    }
    return true;
}
 
Example 9
Source File: Main.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public static boolean start(RootDoc root) {
    for (ClassDoc d : root.classes()) {
        for (AnnotationDesc a : d.annotations()) {
            System.out.println(a.annotationType());
        }
    }
    return true;
}
 
Example 10
Source File: Main.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public static boolean start(RootDoc root) {
    for (ClassDoc d : root.classes()) {
        for (AnnotationDesc a : d.annotations()) {
            System.out.println(a.annotationType());
        }
    }
    return true;
}
 
Example 11
Source File: Main.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public static boolean start(RootDoc root) {
    for (ClassDoc d : root.classes()) {
        for (AnnotationDesc a : d.annotations()) {
            System.out.println(a.annotationType());
        }
    }
    return true;
}
 
Example 12
Source File: Parser.java    From xml-doclet with Apache License 2.0 5 votes vote down vote up
protected Enum parseEnum(ClassDoc classDoc) {
	Enum enumNode = objectFactory.createEnum();
	enumNode.setName(classDoc.name());
	enumNode.setQualified(classDoc.qualifiedName());
	String comment = classDoc.commentText();
	if (comment.length() > 0) {
		enumNode.setComment(comment);
	}
	enumNode.setIncluded(classDoc.isIncluded());
	enumNode.setScope(parseScope(classDoc));

	Type superClassType = classDoc.superclassType();
	if (superClassType != null) {
		enumNode.setClazz(parseTypeInfo(superClassType));
	}

	for (Type interfaceType : classDoc.interfaceTypes()) {
		enumNode.getInterface().add(parseTypeInfo(interfaceType));
	}

	for (FieldDoc field : classDoc.enumConstants()) {
		enumNode.getConstant().add(parseEnumConstant(field));
	}

	for (AnnotationDesc annotationDesc : classDoc.annotations()) {
		enumNode.getAnnotation().add(parseAnnotationDesc(annotationDesc, classDoc.qualifiedName()));
	}

	for (Tag tag : classDoc.tags()) {
		enumNode.getTag().add(parseTag(tag));
	}

	return enumNode;
}
 
Example 13
Source File: Parser.java    From xml-doclet with Apache License 2.0 5 votes vote down vote up
protected Interface parseInterface(ClassDoc classDoc) {

		Interface interfaceNode = objectFactory.createInterface();
		interfaceNode.setName(classDoc.name());
		interfaceNode.setQualified(classDoc.qualifiedName());
		String comment = classDoc.commentText();
		if (comment.length() > 0) {
			interfaceNode.setComment(comment);
		}
		interfaceNode.setIncluded(classDoc.isIncluded());
		interfaceNode.setScope(parseScope(classDoc));

		for (TypeVariable typeVariable : classDoc.typeParameters()) {
			interfaceNode.getGeneric().add(parseTypeParameter(typeVariable));
		}

		for (Type interfaceType : classDoc.interfaceTypes()) {
			interfaceNode.getInterface().add(parseTypeInfo(interfaceType));
		}

		for (MethodDoc method : classDoc.methods()) {
			interfaceNode.getMethod().add(parseMethod(method));
		}

		for (AnnotationDesc annotationDesc : classDoc.annotations()) {
			interfaceNode.getAnnotation().add(parseAnnotationDesc(annotationDesc, classDoc.qualifiedName()));
		}

		for (Tag tag : classDoc.tags()) {
			interfaceNode.getTag().add(parseTag(tag));
		}

		for (FieldDoc field : classDoc.fields()) {
			interfaceNode.getField().add(parseField(field));
		}

		return interfaceNode;
	}
 
Example 14
Source File: Parser.java    From xml-doclet with Apache License 2.0 4 votes vote down vote up
protected Class parseClass(ClassDoc classDoc) {

		Class classNode = objectFactory.createClass();
		classNode.setName(classDoc.name());
		classNode.setQualified(classDoc.qualifiedName());
		String comment = classDoc.commentText();
		if (comment.length() > 0) {
			classNode.setComment(comment);
		}
		classNode.setAbstract(classDoc.isAbstract());
		classNode.setError(classDoc.isError());
		classNode.setException(classDoc.isException());
		classNode.setExternalizable(classDoc.isExternalizable());
		classNode.setIncluded(classDoc.isIncluded());
		classNode.setSerializable(classDoc.isSerializable());
		classNode.setScope(parseScope(classDoc));

		for (TypeVariable typeVariable : classDoc.typeParameters()) {
			classNode.getGeneric().add(parseTypeParameter(typeVariable));
		}

		Type superClassType = classDoc.superclassType();
		if (superClassType != null) {
			classNode.setClazz(parseTypeInfo(superClassType));
		}

		for (Type interfaceType : classDoc.interfaceTypes()) {
			classNode.getInterface().add(parseTypeInfo(interfaceType));
		}

		for (MethodDoc method : classDoc.methods()) {
			classNode.getMethod().add(parseMethod(method));
		}

		for (AnnotationDesc annotationDesc : classDoc.annotations()) {
			classNode.getAnnotation().add(parseAnnotationDesc(annotationDesc, classDoc.qualifiedName()));
		}

		for (ConstructorDoc constructor : classDoc.constructors()) {
			classNode.getConstructor().add(parseConstructor(constructor));
		}

		for (FieldDoc field : classDoc.fields()) {
			classNode.getField().add(parseField(field));
		}

		for (Tag tag : classDoc.tags()) {
			classNode.getTag().add(parseTag(tag));
		}

		return classNode;
	}