src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/LegacyTaglet.java

Tue, 25 May 2010 15:54:51 -0700

author
ohair
date
Tue, 25 May 2010 15:54:51 -0700
changeset 554
9d9f26857129
parent 1
9a66ca7c79fa
child 1359
25e14ad23cef
permissions
-rw-r--r--

6943119: Rebrand source copyright notices
Reviewed-by: darcy

     1 /*
     2  * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     8  * particular file as subject to the "Classpath" exception as provided
     9  * by Oracle in the LICENSE file that accompanied this code.
    10  *
    11  * This code is distributed in the hope that it will be useful, but WITHOUT
    12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    14  * version 2 for more details (a copy is included in the LICENSE file that
    15  * accompanied this code).
    16  *
    17  * You should have received a copy of the GNU General Public License version
    18  * 2 along with this work; if not, write to the Free Software Foundation,
    19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    20  *
    21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    22  * or visit www.oracle.com if you need additional information or have any
    23  * questions.
    24  */
    26 package com.sun.tools.doclets.internal.toolkit.taglets;
    28 import com.sun.javadoc.*;
    30 /**
    31  * This taglet acts as a wrapper to enable
    32  * {@link com.sun.tools.doclets.Taglet} type taglets to work
    33  * with the current version of Javadoc.
    34  * Note: this taglet only works with legacy taglets (those compatible with
    35  * Javadoc 1.4.x) that writes strings.
    36  * This taglet is able to wrap most most legacy taglets because
    37  * the standard doclet is the only known doclet to use legacy taglets.
    38  *
    39  * This code is not part of an API.
    40  * It is implementation that is subject to change.
    41  * Do not use it as an API
    42  *
    43  * @since 1.5
    44  * @author Jamie Ho
    45  */
    47 public class LegacyTaglet implements Taglet {
    49     private com.sun.tools.doclets.Taglet legacyTaglet;
    51     public LegacyTaglet(com.sun.tools.doclets.Taglet t) {
    52         legacyTaglet = t;
    53     }
    55     /**
    56      * {@inheritDoc}
    57      */
    58     public boolean inField() {
    59         return legacyTaglet.isInlineTag() || legacyTaglet.inField();
    60     }
    62     /**
    63      * {@inheritDoc}
    64      */
    65     public boolean inConstructor() {
    66         return legacyTaglet.isInlineTag() || legacyTaglet.inConstructor();
    67     }
    69     /**
    70      * {@inheritDoc}
    71      */
    72     public boolean inMethod() {
    73         return legacyTaglet.isInlineTag() || legacyTaglet.inMethod();
    74     }
    76     /**
    77      * {@inheritDoc}
    78      */
    79     public boolean inOverview() {
    80         return legacyTaglet.isInlineTag() || legacyTaglet.inOverview();
    81     }
    83     /**
    84      * {@inheritDoc}
    85      */
    86     public boolean inPackage() {
    87         return legacyTaglet.isInlineTag() || legacyTaglet.inPackage();
    88     }
    90     /**
    91      * {@inheritDoc}
    92      */
    93     public boolean inType() {
    94         return legacyTaglet.isInlineTag() || legacyTaglet.inType();
    95     }
    97     /**
    98      * Return true if this <code>Taglet</code>
    99      * is an inline tag.
   100      * @return true if this <code>Taglet</code>
   101      * is an inline tag and false otherwise.
   102      */
   103     public boolean isInlineTag() {
   104         return legacyTaglet.isInlineTag();
   105     }
   107     /**
   108      * {@inheritDoc}
   109      */
   110     public String getName() {
   111         return legacyTaglet.getName();
   112     }
   114     /**
   115      * {@inheritDoc}
   116      */
   117     public TagletOutput getTagletOutput(Tag tag, TagletWriter writer)
   118             throws IllegalArgumentException {
   119         TagletOutput output = writer.getOutputInstance();
   120         output.setOutput(legacyTaglet.toString(tag));
   121         return output;
   122     }
   124     /**
   125      * {@inheritDoc}
   126      */
   127     public TagletOutput getTagletOutput(Doc holder, TagletWriter writer)
   128             throws IllegalArgumentException {
   129         TagletOutput output = writer.getOutputInstance();
   130         output.setOutput(legacyTaglet.toString(holder.tags(getName())));
   131         return output;
   132     }
   133 }

mercurial