Blame SOURCES/ExperimentalTaglet.java

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

" + HEADER + "

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

" + HEADER + "

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