how to add new Field and new getter/setter methods to a class object

hi all

i have one scenario where new table gets created run time, where the columns of that table and data type of the columns can be configured by user.

I have to create DTO, referencing this new table.

So is it possible to add new fields and getter setter methods of that fields to be created in the class object of the blank DTO so that this new DTO can contain the data of this new table.

thanks

[430 byte] By [yogeshCAa] at [2007-11-27 10:39:32]
# 1

Could you explain the usage scenario to me, where it would make sense to access fields at runtime your application does not know at compile time? Wouldn't the use of a Map for named attributes/columns be sufficient?

stefan.schulza at 2007-7-28 19:01:42 > top of Java-index,Core,Core APIs...
# 2

Not in Java, no. It's statically typed, so the interface an object exposes is determined at compile-time. Sounds like a fishy design to me, but if it isn't (and it might not be) you could use a Map. Or you could use code generation

Or you could use a language that does allow that sort of metaprogramming, like Javascript or Ruby

georgemca at 2007-7-28 19:01:42 > top of Java-index,Core,Core APIs...