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

" + HEADER + "

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

" + HEADER + "

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