[prev in list] [next in list] [prev in thread] [next in thread] 

List:       struts-dev
Subject:    Re: [PROPOSAL] PropertyUtil.copyProperties()
From:       Ted Husted <husted () apache ! org>
Date:       2001-10-29 12:12:54
[Download RAW message or body]

Yes, it should go to the Commons list now.

John Yu wrote:
> 
> (Not sure if I should post to jakarata-commons instead...)
> 
> I'm thinking for extending PropertyUtil.coptyProperties(). Currently the
> name and the type of the properties must match on both the dest and the
> orig. I'm thinking of including a transforming/converting strategy to deal
> with arbitrary conversion when the names or the types don't match.
> 
> In the context of Struts, this is useful to transport properties between
> frontend formBeans and backend valueObjects.
> 
> I volunteer myself on this.
> 
> The interface with look something like this:
> 
> //-------------------------------------------------------------------------
> public static void copyProperties(java.lang.Object dest,
>                                    java.lang.Object orig,
>                                    Transformer transformer)
>                             throws java.lang.IllegalAccessException,
>                                    java.lang.reflect.InvocationTargetException,
>                                    java.lang.NoSuchMethodException
> 
> //-------------------------------------------------------------------------
> public interface Transformer {
>    public void addAction(String destPropertyName,
>                          String origPropertyName,
>                          TransformAction trans);
> 
>    public void invoke(Object dest, Object orig);
> }
> 
> //-------------------------------------------------------------------------
> public interface TransformAction {
>    /** @return the property on destination */
>    Object public void invoke(Object origProperty);
> }
> 
> Some default transformActions based on the ConvertUtil can be also
> included in the commons package.
> 
> --
> John Yu                       Scioworks Technologies
> e: john@scioworks.com         w: +(65) 873 5989
> w: http://www.scioworks.com   m: +(65) 9782 9610
> 
> Scioworks Camino - "Rapid WebApp Assembly for Struts"
> 
> --
> To unsubscribe, e-mail:   <mailto:struts-dev-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:struts-dev-help@jakarta.apache.org>

--
To unsubscribe, e-mail:   <mailto:struts-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-dev-help@jakarta.apache.org>

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic