using java reflection to dynamically update properties?

E

Elhanan

hi..

for some reason i cannot use java xml blindings but here in xml i have:

<CaseObject TypeId=23>
<AttributeType TypeId=233>
<StringValue Value="Hello"/>
</AttributeType>

<AttributeType TypeId=2323>
<NumericValue Value="2"/>
</AttributeType>

</CaseObject>

what i wanna do is to create a method that given a root of an object
model in POJO as one paramater, and an xml node like the AttributeType
Element, will know to look in a special xml mapping file i will create,
and according to the typeid Attribute specfied in the mapping xml will
update the property of the root object model (or one of its class
propeties) with the class (like NumberClass for numberType and
StringClass for StringValue xml)

for example

for typeid=23 get Create CaseObject1 Object with the property
StringValue Property..

oh and vice versa, a function that will circle through all the
properties of the class, and for each property type create an xml node
for it.


is that possible? (don't know if told it correctly)..
 
E

Elhanan

ok i'm thinking BeanUtils might to the job here..
if i create this xml file

<Typid=426 class=MyClass.MyProperty>

i can do BeanUtils.setProperty(object,classasttibute,ClassObject)

now i need to think about how can create relationships this way

if have this:

<Relation Fromid=1 to Toid=2/
where fromid presents and id another xml element with this id ,and dido
for the toid attribute..

i need to both elements into classes where one class has a collections
of the other class.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,989
Messages
2,570,207
Members
46,783
Latest member
RickeyDort

Latest Threads

Top