You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Gilles Gaillard <gi...@compuserve.com> on 2005/02/03 16:45:15 UTC

[digester] 20903 - CallFactoryMethodRule

Hi Simon,

There are some cases where you know the objects being present on the
Digester's stack. In this case, you would like to be able to access 
them directly so that you can call their methods and pass them 
parameters that are present in the xml attributes.

With further refinement, you would also like to pass to them parameters
that are objects that are already present on the stack. Then once, the 
call return, you would like to push (or not) the result on the stack.

This is what the CallFactoryMethodRule does. 

It is a digester rule that enables to define the caller of the method,
the name of the method and its parameters. The the result of the call
can be pushed on the stack.

The following is an excerpt of a xml digester usage of the rule: 
  <pattern value="employee">
    <call-factory-method-rule 
      methodname="createEmployee" 
      paramtypes="string,string" 
      paramnames="firstName,lastName" pushit="true"/> 
      <set-next-rule methodname="setModel"/>
    <pattern value="address">
      <call-factory-method-rule 
        methodname="createAddress" 
        caller="root"
        paramtypes="string,string,string,string" 
        paramnames="street,city,state,zipCode" 
        pushit="true"/> 
      <call-factory-method-rule 
        methodname="setType" 
        paramtypes="string" 
        paramnames="type"/> 
      <set-next-rule methodname="addAddress"/>
    </pattern>
  </pattern>

There is a more detailled presentation of this in the header of class
CallFactoryMethodRule. 

Regards,

Gilles


>http://issues.apache.org/bugzilla/show_bug.cgi?id=20903
>
>Hi Gilles,
>
>Sorry it took so long to get around to having a look at this bugzilla entry.
>
>A lot of work has clearly gone into the attached code. However I don't really
>understand what the purpose of it is...and send a summary of what this code
>achieves, so that we can all discuss this patch? 
>..
>I am concerned about the significant complexity of the code (as will other
>digester maintainers), and so would like to understand what benefits users would
>gain by having this CallFactoryMethodRule available....
>
>Thanks for your offer of this code, and hope to see your email soon.
>
>Regards,
>
>Simon
>  
>


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


Re: [digester] 20903 - CallFactoryMethodRule

Posted by Gilles Gaillard <gi...@compuserve.com>.
Sorry for the bad formatting, corrected inline.

> Hi Simon,
>
> There are some cases where you know the objects being present on the
> Digester's stack. In this case, you would like to be able to access 
> them directly so that you can call their methods and pass them 
> parameters that are present in the xml attributes.
>
> With further refinement, you would also like to pass to them parameters
> that are objects that are already present on the stack. Then once, the 
> call return, you would like to push (or not) the result on the stack.
>
> This is what the CallFactoryMethodRule does.
> It is a digester rule that enables to define the caller of the method,
> the name of the method and its parameters. The the result of the call
> can be pushed on the stack.
>
> The following is an excerpt of a xml digester usage of the rule: 

  <pattern value="employee">
    <call-factory-method-rule
      methodname="createEmployee"
      paramtypes="string,string"
      paramnames="firstName,lastName" pushit="true"/>
      <set-next-rule methodname="setModel"/>
    <pattern value="address">
      <call-factory-method-rule
        methodname="createAddress"
        caller="root"
        paramtypes="string,string,string,string"
        paramnames="street,city,state,zipCode"
        pushit="true"/>
      <call-factory-method-rule
        methodname="setType"
        paramtypes="string"
        paramnames="type"/>
      <set-next-rule methodname="addAddress"/>
    </pattern>
  </pattern>

>
> There is a more detailled presentation of this in the header of class
> CallFactoryMethodRule.
> Regards,
>
> Gilles
>
>
>> http://issues.apache.org/bugzilla/show_bug.cgi?id=20903
>>
>> Hi Gilles,
>>
>> Sorry it took so long to get around to having a look at this bugzilla 
>> entry.
>>
>> A lot of work has clearly gone into the attached code. However I 
>> don't really
>> understand what the purpose of it is...and send a summary of what 
>> this code
>> achieves, so that we can all discuss this patch? ..
>> I am concerned about the significant complexity of the code (as will 
>> other
>> digester maintainers), and so would like to understand what benefits 
>> users would
>> gain by having this CallFactoryMethodRule available....
>>
>> Thanks for your offer of this code, and hope to see your email soon.
>>
>> Regards,
>>
>> Simon
>>  
>>
>


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