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

" + HEADER + "

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

" + HEADER + "

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