0 Replies Latest reply on Feb 15, 2010 12:18 PM by ciccio ciccio

    New Instance and Setters : All in one task

    ciccio ciccio Newbie

      Hi guys,

      I'm using jBPM 4.3.

      I instantiate an object using a factory and then I need to set its properties and pass it as an argument to another method. The problem is that i can do this in 2 steps:


      I Get the class instance with:

      <java class="jbpm.demo.MyClassFactory" method="getMyClass" name="init" var="myInstance">
                     <string value="MyClassName"/>
            <transition name="to execute" to="execute"/>


      and then I set the properties and call the method with:


      <custom class="jbpm.demo.Executor" name="execute">
                <field name ="classToExecute">
                     <object expr="#{myInstance}">
                          <property name="name"><string value="John Smith"/></property>
                          <property name="City"><string value="New York"/></property>
                <transition name="to end" to="end"/>
      </custom >


      I'd like to merge <java> and <custom> task in one step, but i don't know if it's possible and how to.

      <object class="..."> is not possible to use because I instantiate the class with reflection and the class name can differ from case to case.

      Any suggestions?

      Thanks in advance.