You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Richard <ri...@halldearn.plus.com> on 2003/04/09 13:12:27 UTC

Validator- caching bean reflected getter and setter methods

Hi,

I'm new to validator but I'm getting to grips with it, its a great tool.

I'm interested in the function:
 ValidatorUtil.getValueAsString(Object bean, String property).

it uses the struts method:
PropertyUtils.getProperty(bean, property);

I've not read through the code for this function but presume it does not 
cache the get and set methods (its static). This could be sped up 
significantly if the methods were cached I think. something allong the 
lines:

    if (classMethods.containsKey(className)) {
      //get reference to method caches for class
      readMethod  = 
(HashMap)((HashMap)classMethods.get(className)).get("readMethod");
      writeMethod = 
(HashMap)((HashMap)classMethods.get(className)).get("writeMethod");  

Let me know if this would be a good idea....

Regards

richie

Richard Halldearn
OneContent Developer


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


Validator- caching bean reflected getter and setter methods

Posted by Richard <ri...@halldearn.plus.com>.
Richard wrote:

> Hi,
>
> I'm new to validator but I'm getting to grips with it, its a great tool.
>
> I'm interested in the function:
> ValidatorUtil.getValueAsString(Object bean, String property).
>
> it uses the struts method:
> PropertyUtils.getProperty(bean, property);
>
> I've not read through the code for this function but presume it does 
> not cache the get and set methods (its static). This could be sped up 
> significantly if the methods were cached I think. something allong the 
> lines:
>
>    if (classMethods.containsKey(className)) {
>      //get reference to method caches for class
>      readMethod  = 
> (HashMap)((HashMap)classMethods.get(className)).get("readMethod");
>      writeMethod = 
> (HashMap)((HashMap)classMethods.get(className)).get("writeMethod"); 
> Let me know if this would be a good idea....
>
> Regards
>
> richie
>
> Richard Halldearn
> OneContent Developer
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>
>
>




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