commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Grégory Joseph <joseph.greg...@gmail.com>
Subject Re: org.apache.commons.beanutils.PropertyUtils.describe(Object )
Date Wed, 27 Jul 2005 00:10:10 GMT
Hi Tamas,

On 26/07/05, Tamas Szabo <szabtam@gmail.com> wrote:
> Hi,
> 
> I had some code which gets the properties of a bean and puts them in a Map.
> Now I switched to Commons Beanutils, and I'm using
> org.apache.commons.beanutils.PropertyUtils.describe(Object )
> to do the same, but I learned that the Object.getClass() is considered a
> getter, so I get a class property in the Map.
> In my own code I explicitly checked that the properties are not comming
> from java.lang.Object.
> 
> When I write a Bean I declare all the properties explicitly for it, but
> because every object extends java.lang.Object
>  ==> I will have a class property in all of my beans.
> 
> Is this the normal behaviour?
> Should Object.getClass() be considered a getter and class a property of
> every JavaBean?
> 

I'm not sure it should be considered a JavaBean property indeed, but
anyhow, in our project at worked, we simply created a dumb utility
method that removes the "class" property from the map. As a plus our
code, except that utility class, doesn't depend on beanutils,
anywhere.
(Actually, we needed this to get plain and dumb DTOs from entity EJBs,
so our util also removes references to the home interface etc.. from
the Map)

I suppose this doesn't really *help*, but maybe makes you more
confident in removing that property.

... but in the end, it all depends what you do with that Map.. All we
needed was something we could simply display in a jsp ;-)

Cheers,

g

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


Mime
View raw message