[rules-users] Setting object's WRAPPER OBJECTS fields to complex result in RHS

Edson Tirelli tirelli at post.com
Thu Jun 7 08:55:02 EDT 2007


   Jojan,

   Yes, as I mentioned, it is a JAVA block. What you can do in java, you can
do in RHS... what you can't do in java, you can't do there.

   Although, we are adding MVEL support to version 4.0, where you can use it
instead of java. MVEL has a lot of syntax simplifications to help with such
cases.

   []s
   Edson


2007/6/7, Joj <jojpm at yahoo.com>:
>
>
>
> But I believe tht thr ll be pbms if v try 2 simply operate on fields if
> their types r wrapper objects..
> For e.x:
> If the marks were Double, v cant simply write as :
> student.setTotal( mark1 + mark2 );
>
> instead, v have 2 write as :
> student.setTotal( Double.valueOf( Double.parseDouble("23") +
> Double.parseDouble("18") ) );
>
> where 23 and 18 are String values representing mark1 and mark2.
>
> Or, is there any simpler way 2 do this, to operate on wrapper objects?
>
> Thanks in advance,
> Jojan P.M.
>
>
>
> Edson Tirelli-3 wrote:
> >
> >    RHS is a java block, anything valid in java is valid there... are you
> > sure you are binding the variables?
> >
> > when
> >     student : Student( mark1 : mark1, mark2 : mark2 )
> > then
> >     student.setTotal( mark1 + mark2 );
> > end
> >
> >    []s
> >    Edson
> >
> > 2007/6/1, Joj <jojpm at yahoo.com>:
> >>
> >>
> >> Hi,
> >>
> >> Can't we write on RHS like:
> >>
> >> student.setTotal(mark1 + mark2);
> >> (where mark1 & 2 are variables in student)
> >>
> >> Is it possible? I mean arithmetical operations, calling Java methods,
> etc
> >> from inside setters. If not, is there any other logic to do the same?
> >>
> >>
> >> Please reply A.F.A.P.
> >> Jojan
> >>
> >> --
> >> View this message in context:
> >>
> http://www.nabble.com/Setting-object%27s-fields-to-complex-result-in-RHS-tf3851977.html#a10911851
> >> Sent from the drools - user mailing list archive at Nabble.com.
> >>
> >> _______________________________________________
> >> rules-users mailing list
> >> rules-users at lists.jboss.org
> >> https://lists.jboss.org/mailman/listinfo/rules-users
> >>
> >
> >
> >
> > --
> >   Edson Tirelli
> >   Software Engineer - JBoss Rules Core Developer
> >   Office: +55 11 3529-6000
> >   Mobile: +55 11 9287-5646
> >   JBoss, a division of Red Hat @ www.jboss.com
> >
> > _______________________________________________
> > rules-users mailing list
> > rules-users at lists.jboss.org
> > https://lists.jboss.org/mailman/listinfo/rules-users
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/Setting-object%27s-fields-to-complex-result-in-RHS-tf3851977.html#a11003397
> Sent from the drools - user mailing list archive at Nabble.com.
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>



-- 
  Edson Tirelli
  Software Engineer - JBoss Rules Core Developer
  Office: +55 11 3529-6000
  Mobile: +55 11 9287-5646
  JBoss, a division of Red Hat @ www.jboss.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20070607/fb42a32a/attachment.html 


More information about the rules-users mailing list