xerces-j2/ExperimentalTaglet.java
mbooth c43feda38a - Update to latest upstream version.
- Provide JAXP 1.4.
- Fix some minor rpmlint warnings.
- Add dep on xalan-j2.
- Fix javadoc taglets.
2010-12-12 01:11:58 +00:00

132 lines
3.8 KiB
Java

/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.xerces.util;
import java.util.Map;
import com.sun.javadoc.Tag;
import com.sun.tools.doclets.Taglet;
/**
* This class provides support for a 'xerces.experimental' tag
* in javadoc comments. The tag creates a warning in the generated
* html for users.
*
* @author Ankit Pasricha, IBM
*/
public class ExperimentalTaglet implements Taglet {
private static final String NAME = "xerces.experimental";
private static final String HEADER = "EXPERIMENTAL:";
/* (non-Javadoc)
* @see com.sun.tools.doclets.Taglet#inConstructor()
*/
public boolean inConstructor() {
return false;
}
/* (non-Javadoc)
* @see com.sun.tools.doclets.Taglet#inField()
*/
public boolean inField() {
return false;
}
/* (non-Javadoc)
* @see com.sun.tools.doclets.Taglet#inMethod()
*/
public boolean inMethod() {
return true;
}
/* (non-Javadoc)
* @see com.sun.tools.doclets.Taglet#inOverview()
*/
public boolean inOverview() {
return true;
}
/* (non-Javadoc)
* @see com.sun.tools.doclets.Taglet#inPackage()
*/
public boolean inPackage() {
return false;
}
/* (non-Javadoc)
* @see com.sun.tools.doclets.Taglet#inType()
*/
public boolean inType() {
return true;
}
/* (non-Javadoc)
* @see com.sun.tools.doclets.Taglet#isInlineTag()
*/
public boolean isInlineTag() {
return false;
}
/* (non-Javadoc)
* @see com.sun.tools.doclets.Taglet#getName()
*/
public String getName() {
return NAME;
}
/* (non-Javadoc)
* @see com.sun.tools.doclets.Taglet#toString(com.sun.javadoc.Tag)
*/
public String toString(Tag arg0) {
return "<DT><H1 style=\"font-size:150%\">" + HEADER + "</H1><DD>"
+ "This class should not be considered stable. It is likely to be altered or replaced in the future.<br/>"
+ "<I>" + arg0.text() + "</I></DD>\n";
}
/* (non-Javadoc)
* @see com.sun.tools.doclets.Taglet#toString(com.sun.javadoc.Tag[])
*/
public String toString(Tag[] tags) {
if (tags.length == 0) {
return null;
}
String result = "\n<DT><H1 style=\"font-size:150%\">" + HEADER + "</H1><DD>";
result += "This class should not be considered stable. It is likely to be altered or replaced in the future.";
result += "<I>";
for (int i = 0; i < tags.length; i++) {
result += "<br/>";
result += tags[i].text();
}
return result + "</I></DD>\n";
}
/**
* Register this Taglet.
* @param tagletMap the map to register this tag to.
*/
public static void register(Map tagletMap) {
ExperimentalTaglet tag = new ExperimentalTaglet();
Taglet t = (Taglet) tagletMap.get(tag.getName());
if (t != null) {
tagletMap.remove(tag.getName());
}
tagletMap.put(tag.getName(), tag);
}
}