User: ara_e_w
Date: 02/06/02 00:11:37
Modified: core/src/xdoclet SubTask.java TemplateSubTask.java
Log:
minor fixes (<ofType/>, bringing back subTaskNask with integration into the new
registeration system, blabl).
Revision Changes Path
1.69 +19 -1 xdoclet/core/src/xdoclet/SubTask.java
Index: SubTask.java
===================================================================
RCS file: /cvsroot/xdoclet/xdoclet/core/src/xdoclet/SubTask.java,v
retrieving revision 1.68
retrieving revision 1.69
diff -u -w -r1.68 -r1.69
--- SubTask.java 30 May 2002 18:38:52 -0000 1.68
+++ SubTask.java 2 Jun 2002 07:11:37 -0000 1.69
@@ -23,7 +23,7 @@
*
* @author Ara Abrahamian ([EMAIL PROTECTED])
* @created June 16, 2001
- * @version $Revision: 1.68 $
+ * @version $Revision: 1.69 $
*/
public abstract class SubTask extends DocletSupport implements Serializable
{
@@ -42,12 +42,25 @@
private ArrayList configParams = new ArrayList();
/**
+ * You can explicitly give the task a distinct name. It's useful for
<template/> where if you're going to use config
+ * parameters you have to prefix the parameter with a unique subtask name,
otherwise it's assumed to be a global
+ * config parameter and it means that you can't use the same parameter name in
two <template/> instances.
+ * Overwriting it with this field explicitly gives you the chance to make the
config param a local and solve the
+ * above problem.
+ */
+ private String subTaskName;
+
+ /**
* Gets the SubTaskName attribute of the SubTask object
*
* @return The SubTaskName value
*/
public final String getSubTaskName()
{
+ if (subTaskName != null) {
+ return subTaskName;
+ }
+
return DocletTask.getSubTaskName(getClass());
}
@@ -79,6 +92,11 @@
public File getMergeDir()
{
return mergeDir;
+ }
+
+ public void setSubTaskName(String subTaskName)
+ {
+ this.subTaskName = subTaskName;
}
/**
1.45 +46 -7 xdoclet/core/src/xdoclet/TemplateSubTask.java
Index: TemplateSubTask.java
===================================================================
RCS file: /cvsroot/xdoclet/xdoclet/core/src/xdoclet/TemplateSubTask.java,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -w -r1.44 -r1.45
--- TemplateSubTask.java 31 May 2002 20:43:50 -0000 1.44
+++ TemplateSubTask.java 2 Jun 2002 07:11:37 -0000 1.45
@@ -11,6 +11,7 @@
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
+import java.util.StringTokenizer;
import org.apache.commons.logging.Log;
@@ -35,7 +36,7 @@
* @author Ara Abrahamian ([EMAIL PROTECTED])
* @created Sep 25, 2001
* @xdoclet:subtask name="template" parent="xdoclet.DocletTask"
- * @version $Revision: 1.44 $
+ * @version $Revision: 1.45 $
*/
public class TemplateSubTask extends SubTask
{
@@ -200,7 +201,13 @@
*/
public String[] getOfType()
{
- return (String[]) ofType.toArray(new String[ofType.size()]);
+ String[] result = new String[ofType.size()];
+
+ for (int i = 0; i < ofType.size(); i++) {
+ result[i] = ((OfType) ofType.get(i)).getType();
+ }
+
+ return result;
}
/**
@@ -366,12 +373,26 @@
this.generationManager = gM;
}
+ public void setOfType(String ofType)
+ {
+ StringTokenizer st = new StringTokenizer(ofType, ",");
+
+ while (st.hasMoreTokens()) {
+ String type = st.nextToken();
+
+ OfType new_oftype = new OfType();
+
+ new_oftype.setType(type);
+ addOfType(new_oftype);
+ }
+ }
+
/**
* Sets the OfType attribute of the TemplateSubTask object
*
* @param ofType The new OfType value
*/
- public void addOfType(String ofType)
+ public void addOfType(OfType ofType)
{
this.ofType.add(ofType);
}
@@ -402,8 +423,8 @@
setPrefixWithPackageStructure(src.isPrefixWithPackageStructure());
setDestinationFile(src.getDestinationFile());
setTemplateURL(src.getTemplateURL());
- for (int i = 0; i < src.getOfType().length; i++) {
- addOfType(src.getOfType()[i]);
+ for (int i = 0; i < src.ofType.size(); i++) {
+ addOfType((OfType) src.ofType.get(i));
}
setExtentValue(src.getExtent());
setHavingClassTag(src.getHavingClassTag());
@@ -615,7 +636,7 @@
boolean match = false;
while (it.hasNext()) {
- String type = (String) it.next();
+ String type = (String) ((OfType) it.next()).getType();
if (TypeTagsHandler.isOfType(clazz, type,
TypeTagsHandler.extractExtentType(getExtent())) == true) {
if (log.isDebugEnabled()) {
@@ -743,7 +764,7 @@
* @author Ara Abrahamian ([EMAIL PROTECTED])
* @created July 19, 2001
*/
- public static class ExtentTypes extends
org.apache.tools.ant.types.EnumeratedAttribute
+ public final static class ExtentTypes extends
org.apache.tools.ant.types.EnumeratedAttribute
{
/**
* Gets the Values attribute of the ExtentTypes object
@@ -753,6 +774,24 @@
public java.lang.String[] getValues()
{
return (new java.lang.String[]{"concrete-type", "superclass",
"hierarchy"});
+ }
+ }
+
+ /**
+ * @created June 2, 2002
+ */
+ public final static class OfType
+ {
+ private String type;
+
+ public String getType()
+ {
+ return type;
+ }
+
+ public void setType(String type)
+ {
+ this.type = type;
}
}
}
_______________________________________________________________
Don't miss the 2002 Sprint PCS Application Developer's Conference
August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm
_______________________________________________
Xdoclet-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-devel