Indeed you are right, I got a little too caught up in the depths of my collection problem to see the bigger picture!!
My main problem is that, currently, in Castor XML there does not seem to be a way to have a field implemented as a List using the collection="collection" mapping. Returning/accepting java.util.List in the setter and getter methods causes the exception. Can someone give me a clue if this is possible, other than changing my classes. Theo -----Original Message----- From: Ebersole, Steven [mailto:[EMAIL PROTECTED]] Sent: 10 April 2002 17:49 To: [EMAIL PROTECTED] Subject: Re: [castor-dev] collection="collection" and java.util.List retur n type. That is actually the correct way. In the mapping you define a type java.util.Collection. The the actual object looks to accept a type of java.util.List. This will not work. Look at it this way. Try the following code (which is basically what you are asking Castor to do): public static void main(String args[]) { java.util.Collection myCollection = new java.util.ArrayList(); testMethod( myCollection ); } private void testMethod( java.util.List myList ) { } javac will not even let you compile this code. ******************************************** Steve Ebersole IT Integration Engineer Vignette Corporation 512.741.4195 Visit http://www.vignette.com ******************************************** -----Original Message----- From: Theo Harper [mailto:[EMAIL PROTECTED]] Sent: Wednesday, April 10, 2002 10:53 AM To: [EMAIL PROTECTED] Subject: [castor-dev] collection="collection" and java.util.List return type. I would like some feedback on a possible bug I have found in MappingLoader.java on line 1022, CVS 1.77. The isAssignableFrom test seems to be the wrong way around. (Almost always a source of confusion!!) Here's my scenario. I have a setter on my class which takes java.util.List as an argument, in the mapping file I have defined this field using collection="collection". When I try run my test code, which exercises marshalling and unmarshalling my object I get the following exception: org.exolab.castor.mapping.MappingException: The method setObjects in class Foo accepting/returning object of type interface java.util.Collection was not found. I have tracked this problem down to line 1022 of MappingLoader.java Types.typeFromPrimitive( parameterTypes[0] ).isAssignableFrom( fieldTypeFromPrimitive ) )) { in the debugger this comes out as: java.util.List.isAssignableFrom(java.util.Collection) should this not be: fieldTypeFromPrimitive.isAssignableFrom( Types.typeFromPrimitive( parameterTypes[0] )) )) { Not sure if this is associated with bug 834. Theo _______________________________________________ Xdoclet-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/xdoclet-user ----------------------------------------------------------- If you wish to unsubscribe from this mailing, send mail to [EMAIL PROTECTED] with a subject of: unsubscribe castor-dev ----------------------------------------------------------- If you wish to unsubscribe from this mailing, send mail to [EMAIL PROTECTED] with a subject of: unsubscribe castor-dev ----------------------------------------------------------- If you wish to unsubscribe from this mailing, send mail to [EMAIL PROTECTED] with a subject of: unsubscribe castor-dev
