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

Joj jojpm at yahoo.com
Thu Jun 7 03:42:59 EDT 2007



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.




More information about the rules-users mailing list