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

" + HEADER + "

"
22fe22
        + "Usage of this class is not supported. It may be altered or removed at any time.
"
22fe22
        + "" + arg0.text() + "\n";
22fe22
    }
22fe22
    
22fe22
    /* (non-Javadoc)
22fe22
     * @see com.sun.tools.doclets.Taglet#toString(com.sun.javadoc.Tag[])
22fe22
     */
22fe22
    public String toString(Tag[] tags) {
22fe22
        if (tags.length == 0) {
22fe22
            return null;
22fe22
        }
22fe22
        String result = "\n

" + HEADER + "

";
22fe22
        result += "Usage of this class is not supported. It may be altered or removed at any time.";
22fe22
        result += "";
22fe22
        for (int i = 0; i < tags.length; i++) {
22fe22
            result += "
";
22fe22
            result += tags[i].text();
22fe22
        }
22fe22
        return result + "\n";
22fe22
    }
22fe22
    
22fe22
    /**
22fe22
     * Register this Taglet.
22fe22
     * @param tagletMap  the map to register this tag to.
22fe22
     */
22fe22
    public static void register(Map tagletMap) {
22fe22
        InternalTaglet tag = new InternalTaglet();
22fe22
        Taglet t = (Taglet) tagletMap.get(tag.getName());
22fe22
        if (t != null) {
22fe22
            tagletMap.remove(tag.getName());
22fe22
        }
22fe22
        tagletMap.put(tag.getName(), tag);
22fe22
    }
22fe22
    
22fe22
}