c71c45
/*
c71c45
 * Licensed to the Apache Software Foundation (ASF) under one or more
c71c45
 * contributor license agreements.  See the NOTICE file distributed with
c71c45
 * this work for additional information regarding copyright ownership.
c71c45
 * The ASF licenses this file to You under the Apache License, Version 2.0
c71c45
 * (the "License"); you may not use this file except in compliance with
c71c45
 * the License.  You may obtain a copy of the License at
c71c45
 * 
c71c45
 *      http://www.apache.org/licenses/LICENSE-2.0
c71c45
 * 
c71c45
 * Unless required by applicable law or agreed to in writing, software
c71c45
 * distributed under the License is distributed on an "AS IS" BASIS,
c71c45
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
c71c45
 * See the License for the specific language governing permissions and
c71c45
 * limitations under the License.
c71c45
 */
c71c45
c71c45
package org.apache.xerces.util;
c71c45
c71c45
import java.util.Map;
c71c45
c71c45
import com.sun.javadoc.Tag;
c71c45
import com.sun.tools.doclets.Taglet;
c71c45
c71c45
/**
c71c45
 * This class provides support for a 'xerces.experimental' tag
c71c45
 * in javadoc comments. The tag creates a warning in the generated
c71c45
 * html for users.
c71c45
 * 
c71c45
 * @author Ankit Pasricha, IBM
c71c45
 */
c71c45
public class ExperimentalTaglet implements Taglet {
c71c45
    
c71c45
    private static final String NAME = "xerces.experimental";
c71c45
    private static final String HEADER = "EXPERIMENTAL:";
c71c45
    /* (non-Javadoc)
c71c45
     * @see com.sun.tools.doclets.Taglet#inConstructor()
c71c45
     */
c71c45
    public boolean inConstructor() {
c71c45
        return false;
c71c45
    }
c71c45
    
c71c45
    /* (non-Javadoc)
c71c45
     * @see com.sun.tools.doclets.Taglet#inField()
c71c45
     */
c71c45
    public boolean inField() {
c71c45
        return false;
c71c45
    }
c71c45
    
c71c45
    /* (non-Javadoc)
c71c45
     * @see com.sun.tools.doclets.Taglet#inMethod()
c71c45
     */
c71c45
    public boolean inMethod() {
c71c45
        return true;
c71c45
    }
c71c45
    
c71c45
    /* (non-Javadoc)
c71c45
     * @see com.sun.tools.doclets.Taglet#inOverview()
c71c45
     */
c71c45
    public boolean inOverview() {
c71c45
        return true;
c71c45
    }
c71c45
    
c71c45
    /* (non-Javadoc)
c71c45
     * @see com.sun.tools.doclets.Taglet#inPackage()
c71c45
     */
c71c45
    public boolean inPackage() {
c71c45
        return false;
c71c45
    }
c71c45
    
c71c45
    /* (non-Javadoc)
c71c45
     * @see com.sun.tools.doclets.Taglet#inType()
c71c45
     */
c71c45
    public boolean inType() {
c71c45
        return true;
c71c45
    }
c71c45
    
c71c45
    /* (non-Javadoc)
c71c45
     * @see com.sun.tools.doclets.Taglet#isInlineTag()
c71c45
     */
c71c45
    public boolean isInlineTag() {
c71c45
        return false;
c71c45
    }
c71c45
    
c71c45
    /* (non-Javadoc)
c71c45
     * @see com.sun.tools.doclets.Taglet#getName()
c71c45
     */
c71c45
    public String getName() {
c71c45
        return NAME;
c71c45
    }
c71c45
    
c71c45
    /* (non-Javadoc)
c71c45
     * @see com.sun.tools.doclets.Taglet#toString(com.sun.javadoc.Tag)
c71c45
     */
c71c45
    public String toString(Tag arg0) {
c71c45
        return "

" + HEADER + "

"
c71c45
        + "This class should not be considered stable. It is likely to be altered or replaced in the future.
"
c71c45
        + "" + arg0.text() + "\n";
c71c45
    }
c71c45
    
c71c45
    /* (non-Javadoc)
c71c45
     * @see com.sun.tools.doclets.Taglet#toString(com.sun.javadoc.Tag[])
c71c45
     */
c71c45
    public String toString(Tag[] tags) {
c71c45
        if (tags.length == 0) {
c71c45
            return null;
c71c45
        }
c71c45
        String result = "\n

" + HEADER + "

";
c71c45
        result += "This class should not be considered stable. It is likely to be altered or replaced in the future.";
c71c45
        result += "";
c71c45
        for (int i = 0; i < tags.length; i++) {
c71c45
            result += "
";
c71c45
            result += tags[i].text();
c71c45
        }
c71c45
        return result + "\n";
c71c45
    }
c71c45
    
c71c45
    /**
c71c45
     * Register this Taglet.
c71c45
     * @param tagletMap  the map to register this tag to.
c71c45
     */
c71c45
    public static void register(Map tagletMap) {
c71c45
        ExperimentalTaglet tag = new ExperimentalTaglet();
c71c45
        Taglet t = (Taglet) tagletMap.get(tag.getName());
c71c45
        if (t != null) {
c71c45
            tagletMap.remove(tag.getName());
c71c45
        }
c71c45
        tagletMap.put(tag.getName(), tag);
c71c45
    }
c71c45
    
c71c45
}