You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Markos Charatzas <xa...@forthnet.gr> on 2005/05/16 13:01:43 UTC

[digester] call-method-rule

Hi there,

Is it possible to make a call to 2 different methods under the same pattern?

Thanks in advance,
Markos

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


Re: [digester] call-method-rule

Posted by Markos Charatzas <xa...@forthnet.gr>.
Hey Simon,

Thanks for the detailed response.
I was afraid that a CallMethodParam and a CallMethodRule are associated the 
way you described.

Unfortunately (to me that is), I must have a CallMethodParam since the param 
derives from a pattern associated with an object-create-rule.

see,
<digester-rules>
		<object-create-rule pattern="routes" classname="java.util.ArrayList" />
		<pattern value="routes/route">
			<object-create-rule 
classname="gr.forthnet.enosis.oli.pojos.ScheduledRoute" />									
      <call-method-rule methodname="setStart" paramcount="1" />
      <call-param-rule pattern="from/departure/long" paramnumber="0" />
	    <set-next-rule methodname="add" />
		</pattern>
				
	 <pattern value="routes/route/from">
      <object-create-rule classname="gr.forthnet.enosis.oli.pojos.OLIPort" />
			<bean-property-setter-rule pattern="code" />
      <set-next-rule methodname="setFrom" />
   </pattern>
....


Thanks again,
Markos

On Monday 16 May 2005 16:08, Simon Kitching wrote:
> Hi Markos,
>
> On Mon, 2005-05-16 at 14:01 +0300, Markos Charatzas wrote:
> > Is it possible to make a call to 2 different methods under the same
> > pattern?
>
> It depends. The *calls* will be made, but there is a design flaw in the
> way that CallMethodParam interacts with CallMethodRule that makes things
> tricky when using multiple "interlaced" CallMethodRules.
>
> If one of the calls is made using no parameters, or just one parameter
> being the body of the method, ie
>   digester.addCallMethod(pattern, methodname)
> or
>   digester.addCallMethod(pattern, methodname, 0)
> then I *think* the answer is yes (because no CallParamRule is being used
> for that call).
>
> If both calls have associated CallMethodRule instances, then I *think*
> you'll find that the params get mixed up. The problem is that there is
> just one "param stack", and that CallParamRule objects always work on
> the set of params on top of the param stack, rather than knowing which
> CallMethodRule they are supposed to be associated with.
>
> Please note that I'm not absolutely certain on this; it's been a while
> since I looked at CallMethodRule/CallParamRule.
>
> Regards,
>
> Simon
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org

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


Re: [digester] call-method-rule

Posted by Simon Kitching <sk...@apache.org>.
Hi Markos,

On Mon, 2005-05-16 at 14:01 +0300, Markos Charatzas wrote:
> Is it possible to make a call to 2 different methods under the same pattern?

It depends. The *calls* will be made, but there is a design flaw in the
way that CallMethodParam interacts with CallMethodRule that makes things
tricky when using multiple "interlaced" CallMethodRules.

If one of the calls is made using no parameters, or just one parameter
being the body of the method, ie
  digester.addCallMethod(pattern, methodname)
or
  digester.addCallMethod(pattern, methodname, 0)
then I *think* the answer is yes (because no CallParamRule is being used
for that call).

If both calls have associated CallMethodRule instances, then I *think*
you'll find that the params get mixed up. The problem is that there is
just one "param stack", and that CallParamRule objects always work on
the set of params on top of the param stack, rather than knowing which
CallMethodRule they are supposed to be associated with.

Please note that I'm not absolutely certain on this; it's been a while
since I looked at CallMethodRule/CallParamRule.

Regards,

Simon



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