Update of /cvsroot/xdoclet/xdoclet/core/src/xdoclet
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23242/core/src/xdoclet
Modified Files:
XDocletTagSupport.java
Log Message:
added a method for testing a class against the havingClassTag attribute of the
current subtask (XDT-943)
Index: XDocletTagSupport.java
===================================================================
RCS file: /cvsroot/xdoclet/xdoclet/core/src/xdoclet/XDocletTagSupport.java,v
retrieving revision 1.60
retrieving revision 1.61
diff -C2 -r1.60 -r1.61
*** XDocletTagSupport.java 10 Oct 2004 22:32:16 -0000 1.60
--- XDocletTagSupport.java 1 Mar 2005 22:42:52 -0000 1.61
***************
*** 9,16 ****
--- 9,19 ----
import java.util.StringTokenizer;
+ import org.apache.commons.logging.Log;
+
import xjavadoc.*;
import xdoclet.template.TemplateEngine;
import xdoclet.template.TemplateException;
import xdoclet.template.TemplateTagHandler;
+ import xdoclet.util.LogUtil;
import xdoclet.util.Translator;
import xdoclet.util.TypeConversionUtil;
***************
*** 775,777 ****
--- 778,820 ----
new String[]{paramName, templateTagName}));
}
+
+ /**
+ * Tests whether the passed class has the tag which is specfied in the
<code>havingClassTag</code> attribute of the
+ * current subtask.
+ *
+ * @param clazz the Class to check
+ * @return <code>true</code> if the current subtask has no
<code>havingClassTag</code> or the passed class has
+ * a tag with the same name as the <code>havingClassTag</code>
attribute of the current subtask, otherwise
+ * <code>false</code>
+ */
+ protected boolean hasHavingClassTag(XClass clazz)
+ {
+ Log log = LogUtil.getLog(getClass(), "hasHavingClassTag");
+
+ DocletContext ctx = getDocletContext();
+ SubTask task = ctx.getActiveSubTask();
+
+ if (!(task instanceof TemplateSubTask)) {
+ return true;
+ }
+
+ TemplateSubTask templTask = (TemplateSubTask) task;
+
+ if (templTask.getHavingClassTag() == null) {
+ return true;
+ }
+
+ if (!clazz.getDoc().hasTag(templTask.getHavingClassTag(), false)) {
+ if (log.isDebugEnabled()) {
+ log.debug("Reject class '" + clazz.getQualifiedName() + "'
because it doesn't have class tag '" + templTask.getHavingClassTag() + "'.");
+ }
+ return false;
+ }
+ else {
+ if (log.isDebugEnabled()) {
+ log.debug("Accept class '" + clazz.getQualifiedName() + "'
because it has class tag '" + templTask.getHavingClassTag() + "'.");
+ }
+ return true;
+ }
+ }
}
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
xdoclet-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xdoclet-devel