Blame SOURCES/InternalTaglet.java

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

" + HEADER + "

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

" + HEADER + "

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