Two Laptop Bag
The moose likes IDEs, Version Control and other tools and the fly likes A Castor question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "A Castor question" Watch "A Castor question" New topic

A Castor question

Karthik Veeramani
Ranch Hand

Joined: Dec 22, 2002
Posts: 132
I'm a beginner to castor. Im using a mapping file and marshalling some objects.
In a certain class, I have a HashSet member, that stores a collection of another object. I have getter and setter but they dont actually take in and return HashSets; rather their input is an array of objects. please see below.
class Test {
HashSet data; // say, this stores a set of objects of type MyObj.
public void setData(MyObj[] objs) {
// convert the array into hashset and store.
public MyObj[] getData () {
// convert the hashset to array and return.
when i try to marshall this object, i get an exception related to this field, like
"access resulted in exception: java.lang.reflect.InvocationTargetException"
My mapping file has the following lines, incase u need it -
<field name="data"<br /> type="packagename.MyObj"<br /> get-method="getData"<br /> set-method="setData"<br /> collection="array">
<bind-xml name="data"/>

Please tell me where I'm going wrong.

Thanks<br />Karthik<br />SCJP 1.4, CCNA.<br /> <br />"Success is relative. More the success, more the relatives."
I agree. Here's the link:
subject: A Castor question
It's not a secret anymore!