commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ole Ersoy <ole.er...@gmail.com>
Subject Re: [BeanUtils] BeanUtils and Introspector
Date Wed, 19 Dec 2007 20:06:19 GMT
Hi Roshan,

The dynamic properties would first have to be added to the bean's EClass.  Then you would
access the dynamic properties using EMF's reflective methods, eGet() and eSet().  So for instance
if you added a property "Street"...note that you would first have to model this as an EAttribute,
and then add the EAttribute to the EClass, ...anyways, assuming you added it...you would then
get the property on an instance of the EClass like this:

someObject.eGet("Street");

The general sequence is to create a EClass.

Add EReferences (Representing references) and EAttributes (Representing primitive properties...non
object references).

Create an instance of the EClass.  someObject = EFactory.create(myEClass);

Then later if you need to add primitive properties, you just add more EAttributes to the EClass
and then create another instance.  Now the instance will have these properties, and you can
set and get them using eGet and eSet.

Tuscany Service Data Objects work in a similar way.

Cheers,
- Ole







Roshan A. Punnoose wrote:
> Thanks!
> 
> The article looks great.
> 
> I just tried the code, but it doesn't seem to generate getters and
> setters dynamically, which seem to be needed by the JavaBeans
> Introspector to recognize properties.
> 
> Roshan
> 
> -----Original Message-----
> From: Ole Ersoy [mailto:ole.ersoy@gmail.com] 
> Sent: Wednesday, December 19, 2007 2:03 PM
> To: Jakarta Commons Users List
> Subject: Re: BeanUtils and Introspector
> 
> Hi Roshan,
> 
> I just happened to see this, and the JavaBeans Introspector stuff is
> completely new to me.  However both Eclipse EMF beans / modeled classes
> and Apache Tuscany SDO (Service Data Objects) support adding properties
> dynamically.  There's a really good article on how to do it using EMF
> here:
> 
> http://www.devx.com/Java/Article/29093
> 
> Sorry I could not give you a more direct answer.
> 
> Cheers,
> - Ole
> 
> 
> 
> Roshan A. Punnoose wrote:
>> Hi,
>>
>>  
>>
>> I didn't see this on the User Guide, but is it possible to add dynamic
>> properties to a JavaBean and have the JavaBeans Introspector pick it
> up?
>> For example, if I have an Object Temporary, and at runtime, I want to
>> add properties (getter and setter methods) to it, then use the
>> Introspector class to get these dynamic properties, is that possible?
>>
>>  
>>
>> Roshan
>>
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Mime
View raw message