On Wed, Jul 10, 2002 at 03:23:50PM -0700, [EMAIL PROTECTED] wrote:
+ hi,
+ 
+   look like ValueObjectTagsHandler.forAllRelation() the only valid collection
+ class is java.util.Collection. i happen to use java.util.Set in my entity
+ beans so i was working on a patch. before i work on the patch any more i was
+ wondering if this was done on purpose. please let me know either way.


the patch is below. it allows the user to specify Set in addition to
Collection.

list has been quiet past couple of days.

barbee.

Index: modules/ejb/src/xdoclet/modules/ejb/entity/ValueObjectTagsHandler.java
===================================================================
RCS file: 
/cvsroot/xdoclet/xdoclet/modules/ejb/src/xdoclet/modules/ejb/entity/ValueObjectTagsHandler.java,v
retrieving revision 1.8
diff -u -r1.8 ValueObjectTagsHandler.java
--- modules/ejb/src/xdoclet/modules/ejb/entity/ValueObjectTagsHandler.java      25 Jun 
2002 14:16:15 -0000      1.8
+++ modules/ejb/src/xdoclet/modules/ejb/entity/ValueObjectTagsHandler.java      11 Jul 
+2002 00:17:21 -0000
@@ -389,6 +389,31 @@
     }
 
     /**
+     * Type of the constructor for aggregates or compositions.
+     *
+     * @return                      Type of the constructor for aggregates or 
+compositions.
+     * @exception XDocletException
+     */
+    public String concreteCollectionType() throws XDocletException
+    {
+        String currentReturnType = 
+getCurrentMethod().getReturnType().getQualifiedName();
+        String res = null;
+
+        if (currentReturnType.equals("java.util.Collection")) {
+            res = "java.util.ArrayList";
+        }
+        else if (currentReturnType.equals("java.util.Set")) {
+            res = "java.util.HashSet";
+        }
+        else {
+            throw new XDocletException("Invalid return type (" +
+                currentReturnType +
+                " on aggregate or composition.");
+        }
+        return res;
+    }
+
+    /**
      * Returns the data-object class name highest in the hierarchy of derived beans. 
Because of possible inheritance
      * between entity bean, the type of the generated getData method must be the one 
of the most super class of the
      * current entity bean. The current Data class must extend the corresponding 
super Data class.
@@ -647,15 +672,18 @@
                             }
 
                             if (aggreg != null) {
+                                String currentReturnType = 
+getCurrentMethod().getReturnType().getQualifiedName();
+
                                 if (log.isDebugEnabled()) {
-                                    log.debug("********* METHOD=" + 
getCurrentMethod().getName() + " " + 
getCurrentMethod().getReturnType().getQualifiedName());
+                                    log.debug("********* METHOD=" + 
+getCurrentMethod().getName() + " " + currentReturnType);
                                 }
 
                                 // Store that we found this field so we don't add it 
twice
                                 foundFields.put(getCurrentMethod().getName(), 
getCurrentMethod().getName());
-                                if 
(getCurrentMethod().getReturnType().getQualifiedName().equals("java.util.Collection")) 
{
+                                if (currentReturnType.equals("java.util.Collection") 
+||
+                                    currentReturnType.equals("java.util.Set")) {
                                     if (log.isDebugEnabled()) {
-                                        log.debug("********* Type Collection");
+                                        log.debug("********* Type Collection or Set");
                                     }
                                     currentAggregateType = aggreg;
                                     currentAggregateName = aggregName;
Index: modules/ejb/src/xdoclet/modules/ejb/entity/resources/valueobject.xdt
===================================================================
RCS file: 
/cvsroot/xdoclet/xdoclet/modules/ejb/src/xdoclet/modules/ejb/entity/resources/valueobject.xdt,v
retrieving revision 1.5
diff -u -r1.5 valueobject.xdt
--- modules/ejb/src/xdoclet/modules/ejb/entity/resources/valueobject.xdt        10 Jul 
2002 21:49:24 -0000      1.5
+++ modules/ejb/src/xdoclet/modules/ejb/entity/resources/valueobject.xdt        11 Jul 
+2002 00:17:23 -0000
@@ -23,7 +23,7 @@
    private boolean <XDtEjbValueObj:currentAggregateName/>HasBeenSet = false;
    </XDtMethod:ifDoesntHaveMethodTag>
   <XDtMethod:ifHasMethodTag tagName="ejb:value-object" paramName="type">
-   private <XDtMethod:methodTagValue tagName="ejb:value-object" paramName="type"/> 
<XDtEjbValueObj:currentAggregateName/>s = new java.util.ArrayList();
+   private <XDtMethod:methodTagValue tagName="ejb:value-object" paramName="type"/> 
+<XDtEjbValueObj:currentAggregateName/>s = new 
+<XDtEjbValueObj:concreteCollectionType/>();
    </XDtMethod:ifHasMethodTag>
   </XDtEjbValueObj:forAllRelations>
 
@@ -128,13 +128,13 @@
    }
   </XDtMethod:ifDoesntHaveMethodTag>
   <XDtMethod:ifHasMethodTag tagName="ejb:value-object" paramName="type">
-   protected java.util.Collection added<XDtEjbValueObj:currentAggregateName/>s = new 
java.util.ArrayList();
-   protected java.util.Collection removed<XDtEjbValueObj:currentAggregateName/>s = 
new java.util.ArrayList();
-   protected java.util.Collection updated<XDtEjbValueObj:currentAggregateName/>s = 
new java.util.ArrayList();
-
-   public java.util.Collection getAdded<XDtEjbValueObj:currentAggregateName/>s() { 
return added<XDtEjbValueObj:currentAggregateName/>s; }
-   public java.util.Collection getRemoved<XDtEjbValueObj:currentAggregateName/>s() { 
return removed<XDtEjbValueObj:currentAggregateName/>s; }
-   public java.util.Collection getUpdated<XDtEjbValueObj:currentAggregateName/>s() { 
return updated<XDtEjbValueObj:currentAggregateName/>s; }
+   protected <XDtMethod:methodTagValue tagName="ejb:value-object" paramName="type"/> 
+added<XDtEjbValueObj:currentAggregateName/>s = new 
+<XDtEjbValueObj:concreteCollectionType/>();
+   protected <XDtMethod:methodTagValue tagName="ejb:value-object" paramName="type"/> 
+removed<XDtEjbValueObj:currentAggregateName/>s = new 
+<XDtEjbValueObj:concreteCollectionType/>();
+   protected <XDtMethod:methodTagValue tagName="ejb:value-object" paramName="type"/> 
+updated<XDtEjbValueObj:currentAggregateName/>s = new 
+<XDtEjbValueObj:concreteCollectionType/>();
+
+   public <XDtMethod:methodTagValue tagName="ejb:value-object" paramName="type"/> 
+getAdded<XDtEjbValueObj:currentAggregateName/>s() { return 
+added<XDtEjbValueObj:currentAggregateName/>s; }
+   public <XDtMethod:methodTagValue tagName="ejb:value-object" paramName="type"/> 
+getRemoved<XDtEjbValueObj:currentAggregateName/>s() { return 
+removed<XDtEjbValueObj:currentAggregateName/>s; }
+   public <XDtMethod:methodTagValue tagName="ejb:value-object" paramName="type"/> 
+getUpdated<XDtEjbValueObj:currentAggregateName/>s() { return 
+updated<XDtEjbValueObj:currentAggregateName/>s; }
 
    public <XDtEjbValueObj:currentAggregateType/>[] 
get<XDtEjbValueObj:currentAggregateName/>s()
    {
@@ -165,9 +165,9 @@
    }
 
    public void clean<XDtEjbValueObj:currentAggregateName/>(){
-         this.added<XDtEjbValueObj:currentAggregateName/>s = new 
java.util.ArrayList();
-         this.removed<XDtEjbValueObj:currentAggregateName/>s = new 
java.util.ArrayList();
-         this.updated<XDtEjbValueObj:currentAggregateName/>s = new 
java.util.ArrayList();
+         this.added<XDtEjbValueObj:currentAggregateName/>s = new 
+<XDtEjbValueObj:concreteCollectionType/>();
+         this.removed<XDtEjbValueObj:currentAggregateName/>s = new 
+<XDtEjbValueObj:concreteCollectionType/>();
+         this.updated<XDtEjbValueObj:currentAggregateName/>s = new 
+<XDtEjbValueObj:concreteCollectionType/>();
    }
 
    public void 
copy<XDtEjbValueObj:currentAggregateName/>sFrom(<XDtEjbValueObj:valueObjectClass/> 
from)


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Two, two, TWO treats in one.
http://thinkgeek.com/sf
_______________________________________________
Xdoclet-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-user

Reply via email to