You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by Joe Germuska <Jo...@Germuska.com> on 2005/05/26 01:55:03 UTC

copy properties for inheritance (Re: svn commit: r178550)

I was wondering about this:

>                  BeanUtils.copyProperties(copy, baseHandler);
>                  this.addExceptionConfig(copy);
>-
>+                copy.setProperties(baseHandler.getProperties());
>+

  doesn't the strategy you implemented clobber properties which are 
set on the extending/copy?  Shouldn't this process somehow honor 
properties which were already set in the copy?  I think it should go 
through the list of property names in the baseHandler and, where the 
property is not already defined in the copy, in those cases it should 
copy them.

I haven't studied this, so forgive me if I'm overlooking something....

Joe



-- 
Joe Germuska            
Joe@Germuska.com  
http://blog.germuska.com    
"Narrow minds are weapons made for mass destruction"  -The Ex

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


Re: copy properties for inheritance (Re: svn commit: r178550)

Posted by Hubert Rabago <hr...@gmail.com>.
On 5/25/05, Joe Germuska <Jo...@germuska.com> wrote:
> I was wondering about this:
> 
> >                  BeanUtils.copyProperties(copy, baseHandler);
> >                  this.addExceptionConfig(copy);
> >-
> >+                copy.setProperties(baseHandler.getProperties());
> >+
> 
>  doesn't the strategy you implemented clobber properties which are
> set on the extending/copy?  Shouldn't this process somehow honor
> properties which were already set in the copy?  I think it should go
> through the list of property names in the baseHandler and, where the
> property is not already defined in the copy, in those cases it should
> copy them.
> 

This part of the code executes when the extending config object
(ActionConfig in this case) isn't overriding baseHandler:

            // Do we have this handler?
            ExceptionConfig copy =
                    this.findExceptionConfig(baseHandler.getType());

            if (copy == null) {

                // We don't have this, so let's copy it
                copy = (ExceptionConfig) RequestUtils
                        .applicationInstance(baseHandler.getClass().getName());

                BeanUtils.copyProperties(copy, baseHandler);
                this.addExceptionConfig(copy);
                copy.setProperties(baseHandler.getProperties());
                
            } else {

                // process any extension that this config might have
                copy.processExtends(getModuleConfig(), this);

            }


Hubert

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