Sorry
about the Member variables being private. I put this sample together quickly
without much validation to illustrate my problem.
My
requirement is that the value of a member variable is dependant on the name of
the element I am processing.
For
Example I have a mapping with the Car make and the country the company is
located. So if the element name is "Toyota", I want to derive the country to be
"Japan" from another mapping that I may have defined in the Database.
I can achieve this using a field handler if I can know
what is the name of the element within the context of the field handler and
such.
Thanks
Balaji
-----Original Message-----
From: Brent Picasso [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 03, 2004 2:23 PM
To: [EMAIL PROTECTED]
Subject: Re: [castor-dev] Map the name of the Element as value into a fieldfirst, the properties in your class need to be accessable through public bean getter/setters, or make the member variables public.With Toyota/BMW you're implying some polymorphism, in which case you'll probably want something like a "Car" interface with specific implementations that derive from it.The docs at castor.org are a good resource and have great detail.Brent-----Original Message-----
From: Adikesavelu, Balaji [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 03, 2004 10:45 AM
To: '[EMAIL PROTECTED]'
Subject: [castor-dev] Map the name of the Element as value into a fieldIs it possible to map the element name to a field in the Java object?
E.g.
<Cars>
<Toyota>
<year>1997</year>
</Toyota>
<BMW>
<year>2003</year>
</BMW>
</Cars>Public class Cars{
Car[] myCars;
}Public class Car{
Private String name;
Private String year;
}I want to Map the name of the Element like "Toyota" and "BMW" to the member variable "name" in Car.
Is this possible?
Thanks
Balaji
