Blame SOURCES/ExperimentalTaglet.java

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

" + HEADER + "

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

" + HEADER + "

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