commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gilles Gaillard <gillesGaill...@compuserve.com>
Subject [digester] 20903 - CallFactoryMethodRule
Date Thu, 03 Feb 2005 15:45:15 GMT
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


Mime
View raw message