Blame SOURCES/ExperimentalTaglet.java

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

" + HEADER + "

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

" + HEADER + "

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