com.sun.javadoc.ProgramElementDoc Java Examples

The following examples show how to use com.sun.javadoc.ProgramElementDoc. 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: DefaultApidocExcluder.java    From sarl with Apache License 2.0 6 votes vote down vote up
@Override
public boolean isExcluded(Doc doc) {
	if (Utils.isHiddenMember(doc.name())) {
		return true;
	}
	if (doc.tags(EXCLUDE_FROM_JAVADOC_TAG).length > 0) {
		return true;
	}
	if (doc instanceof ProgramElementDoc) {
		final ProgramElementDoc element = (ProgramElementDoc) doc;
		if (element.containingPackage().tags(EXCLUDE_FROM_JAVADOC_TAG).length > 0) {
			return true;
		}
		if (Utils.findFirst(element.annotations(), it ->
			Utils.qualifiedNameEquals(
					Utils.getKeywords().getSyntheticMemberAnnotationName(),
					it.annotationType().qualifiedName())) != null) {
			return true;
		}
	}
	// nothing above found a reason to exclude
	return false;
}
 
Example #2
Source File: DocTestSuite.java    From joinery with GNU General Public License v3.0 6 votes vote down vote up
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;
}
 
Example #3
Source File: RootDocProcessor.java    From pom-manipulation-ext with Apache License 2.0 6 votes vote down vote up
private static boolean exclude( Doc doc )
{
    AnnotationDesc[] annotations = null;
    if ( doc instanceof ProgramElementDoc )
    {
        annotations = ( (ProgramElementDoc) doc ).annotations();
    }
    else if ( doc instanceof PackageDoc )
    {
        annotations = ( (PackageDoc) doc ).annotations();
    }
    if ( annotations != null )
    {
        for ( AnnotationDesc annotation : annotations )
        {
            String qualifiedTypeName = annotation.annotationType().qualifiedTypeName();
            if ( qualifiedTypeName.equals( JavadocExclude.class.getCanonicalName() ) )
            {
                return true;
            }
        }
    }
    // nothing above found a reason to exclude
    return false;
}
 
Example #4
Source File: ExcludeDoclet.java    From Tehreer-Android with Apache License 2.0 5 votes vote down vote up
private static boolean exclude(Doc doc) {
    if (doc.tags(TAG_HIDE).length > 0) {
        return true;
    }
    if (doc instanceof ProgramElementDoc) {
        if (((ProgramElementDoc) doc).containingPackage().tags(TAG_HIDE).length > 0) {
            return true;
        }
    }

    return false;
}
 
Example #5
Source File: DefaultApidocExcluder.java    From sarl with Apache License 2.0 5 votes vote down vote up
@Override
public boolean isTranslatableToTag(Doc doc) {
	if (doc instanceof ProgramElementDoc) {
		final ProgramElementDoc element = (ProgramElementDoc) doc;
		if (Utils.findFirst(element.annotations(), it ->
			Utils.qualifiedNameEquals(
					Utils.getKeywords().getSyntheticMemberAnnotationName(),
					it.annotationType().qualifiedName())) != null) {
			return true;
		}
	}
	return false;
}
 
Example #6
Source File: Utils.java    From sarl with Apache License 2.0 5 votes vote down vote up
/** Find the first element into the given array.
 *
 * @param <T> the type of the elements to filter.
 * @param original the original array.
 * @param ignoreHidden indicates if the hidden elements should be ignored.
 * @param filter the filtering action.
 * @return the first element.
 */
public static <T extends ProgramElementDoc> T findFirst(T[] original, boolean ignoreHidden, Predicate<T> filter) {
	for (final T element : original) {
		if (!ignoreHidden || !isHiddenMember(element.name())) {
			if (filter.test(element)) {
				return element;
			}
		}
	}
	return null;
}
 
Example #7
Source File: Utils.java    From sarl with Apache License 2.0 5 votes vote down vote up
/** Replies the SARL element type of the given type.
 *
 * @param type the type.
 * @return the SARL element type, or {@code null} if unknown.
 */
public static Integer getSarlClassification(ProgramElementDoc type) {
	final AnnotationDesc annotation = Utils.findFirst(type.annotations(), it ->
			qualifiedNameEquals(it.annotationType().qualifiedTypeName(), getKeywords().getSarlElementTypeAnnotationName()));
	if (annotation != null) {
		final ElementValuePair[] pairs = annotation.elementValues();
		if (pairs != null && pairs.length > 0) {
			return ((Number) pairs[0].value().value()).intValue();
		}
	}
	return null;
}
 
Example #8
Source File: Parser.java    From xml-doclet with Apache License 2.0 5 votes vote down vote up
/**
 * 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 "";
}