Search in sources :

Example 11 with Tag

use of com.sun.javadoc.Tag in project RESTdoclet by IG-Group.

the class DocTypeUtils method getDeprecatedURIs.

/**
    * Return a string array of deprecated URIs for this element, searching for
    * DEPRECATED_TAG in the method comment
    * 
    * @param element javadoc element
    * @return a string array of deprecated URIs for this element
    */
public static String[] getDeprecatedURIs(final ProgramElementDoc element) {
    String[] uris = null;
    Tag[] tags = element.tags();
    for (final Tag tag : tags) {
        final String name = tag.name();
        if (StringUtils.contains(name, DEPRECATED_TAG)) {
            uris = parseMultiUri(tag.text());
            LOG.debug("deprecated uris" + tag.text());
            break;
        }
    }
    return uris;
}
Also used : Tag(com.sun.javadoc.Tag)

Example 12 with Tag

use of com.sun.javadoc.Tag in project RESTdoclet by IG-Group.

the class DocTypeUtils method getReturnDoc.

/**
    * Generates a comment string from the given method, consisting of the
    * method return comment and if the return type is an iggroup type, a list
    * of attributes (separated by <br>
    * )
    * 
    * @param element method doc
    * @return documentation string for the method
    */
public static String getReturnDoc(final MethodDoc element) {
    LOG.info("Get return type documentation for method: " + element.toString());
    String doc = "";
    Tag[] tags = element.tags();
    String typeDoc = getTypeDoc(element.returnType());
    for (final Tag tag : tags) {
        final String name = tag.name();
        if (StringUtils.contains(name, RETURN_TAG)) {
            doc = tag.text();
            if (!typeDoc.isEmpty()) {
                doc += "<table><tr><td>" + typeDoc + "</td></tr></table>";
            }
            break;
        }
    }
    //}
    return doc;
}
Also used : Tag(com.sun.javadoc.Tag)

Example 13 with Tag

use of com.sun.javadoc.Tag in project jangaroo-tools by CoreMedia.

the class Util method extractTags.

public static Tag[] extractTags(Doc holder, String text) {
    List tags = new ArrayList();
    Matcher tagMatcher = TOP_LEVEL_TAG_PATTERN.matcher(text);
    boolean found;
    int start = 0;
    do {
        found = tagMatcher.find();
        int end = found ? tagMatcher.start() : text.length();
        Tag tag = createTag(holder, text.substring(start, end));
        tags.add(tag);
        start = end;
    } while (found);
    return (Tag[]) tags.toArray(new Tag[tags.size()]);
}
Also used : Matcher(java.util.regex.Matcher) ArrayList(java.util.ArrayList) List(java.util.List) ArrayList(java.util.ArrayList) Tag(com.sun.javadoc.Tag)

Example 14 with Tag

use of com.sun.javadoc.Tag in project jangaroo-tools by CoreMedia.

the class DocImpl method initTags.

private void initTags() {
    allTags = NO_TAGS;
    firstSentenceTags = NO_TAGS;
    this.tagsByName = new HashMap();
    if (((IdeDeclaration) declaration).getSymModifiers().length > 0) {
        String text = Util.tidy(((IdeDeclaration) declaration).getSymModifiers()[0].getWhitespace());
        if (text.length() > 0) {
            allTags = Util.extractTags(this, text);
            firstSentenceTags = Util.extractInlineTags(this, Util.firstSentence(text));
            Map /*String->List<Tag>*/
            tagsByName = new HashMap();
            for (int i = 0; i < allTags.length; i++) {
                Tag tag = allTags[i];
                List tags = (List) tagsByName.get(tag.name());
                if (tags == null) {
                    tags = new ArrayList();
                    tagsByName.put(tag.name(), tags);
                }
                tags.add(tag);
            }
            for (Iterator iterator = tagsByName.entrySet().iterator(); iterator.hasNext(); ) {
                Map.Entry entry = (Map.Entry) iterator.next();
                List /*Tag*/
                tagList = (List) entry.getValue();
                Object tagName = entry.getKey();
                this.tagsByName.put(tagName, tagList.toArray(new Tag[tagList.size()]));
            }
        }
    }
}
Also used : IdeDeclaration(net.jangaroo.jooc.IdeDeclaration) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator) List(java.util.List) ArrayList(java.util.ArrayList) SeeTag(com.sun.javadoc.SeeTag) Tag(com.sun.javadoc.Tag) Map(java.util.Map) HashMap(java.util.HashMap)

Example 15 with Tag

use of com.sun.javadoc.Tag in project RoboBinding by RoboBinding.

the class EventTaglet method getTagletOutput.

public TagletOutput getTagletOutput(Doc doc, TagletWriter tagletWriter) throws IllegalArgumentException {
    Tag[] tags = doc.tags(NAME);
    if (tags.length == 0) {
        return null;
    }
    TagletWriterImpl tagletWriterImpl = (TagletWriterImpl) tagletWriter;
    StringBuilder sb = new StringBuilder();
    sb.append("<table style=\"border: 2px solid gray\"><caption style=\"text-align:left\"><strong>Supported Events</strong></caption><tr style=\"background-color:#555555; color: #ffffff\"><th>Name</th><th>Event class</th></tr>");
    for (int i = 0; i < tags.length; i++) {
        Tag tag = tags[i];
        Event event = parser.parse(tag);
        String translatedClassName = inlineLinkTagTranslator.translate(event.getClassName(), tag, doc, tagletWriterImpl);
        sb.append(MessageFormat.format("<tr style=\"background-color:{0}\"><td><strong>{1}</strong></td><td>{2}</td></tr>", (i % 2 == 0) ? "#eeeeef" : "#ffffff", event.getName(), translatedClassName));
    }
    sb.append("</table></br>");
    return new TagletOutputImpl(sb.toString());
}
Also used : Tag(com.sun.javadoc.Tag) TagletOutputImpl(com.sun.tools.doclets.formats.html.TagletOutputImpl) TagletWriterImpl(com.sun.tools.doclets.formats.html.TagletWriterImpl)

Aggregations

Tag (com.sun.javadoc.Tag)23 SeeTag (com.sun.javadoc.SeeTag)7 ParamTag (com.sun.javadoc.ParamTag)6 ArrayList (java.util.ArrayList)6 List (java.util.List)5 Test (org.junit.Test)4 Matcher (java.util.regex.Matcher)3 ClassDoc (com.sun.javadoc.ClassDoc)2 MethodDoc (com.sun.javadoc.MethodDoc)2 TagletOutputImpl (com.sun.tools.doclets.formats.html.TagletOutputImpl)2 TagletWriterImpl (com.sun.tools.doclets.formats.html.TagletWriterImpl)2 HashMap (java.util.HashMap)2 RepresentationDocType (org.glassfish.jersey.server.wadl.internal.generators.resourcedoc.model.RepresentationDocType)2 JSONObject (org.json.JSONObject)2 JavadocInlineTagHandler (com.eden.orchid.javadoc.api.JavadocInlineTagHandler)1 Parameter (com.sun.javadoc.Parameter)1 OutputStream (java.io.OutputStream)1 Enumeration (java.util.Enumeration)1 Hashtable (java.util.Hashtable)1 Iterator (java.util.Iterator)1