[rules-users] drrols type declaration and how are the equals and hashcode for those types implemented...

Edson Tirelli tirelli at post.com
Mon Feb 23 19:49:28 EST 2009


      We need to improve docs on that, as it is only mentioned briefly:

https://hudson.jboss.org/hudson/job/drools/lastSuccessfulBuild/artifact/trunk/target/docs/drools-expert/html/ch07.html#d0e3206

      The @key will do it for you:

declare Person
    name : String
    ssn : BigDecimal @key
    age : int
end

     Wanna write a quick patch for the docs emphasizing the use of it?

     Thanks,

     []s
     Edson

2009/2/23 Zoltan Farkas <zoly at daxtechnologies.com>

>  declare Person
>
>   name : String
>
>   ssn: BigDecimal
>
>   age : int
>
> end
>
>
>
>
>
> Is there a way to define what field/s identify a Person?
>
>
>
> In the example above I would like to define ssn as the unique indentifier
> for person, so person1 == person2 if person1.ssn == person2.ssn.
>
>
>
> In this case equals would use only the field ssn to determine if 2 person
> objects are equal.
>
> The hashcode should also be based only on the ssn field.
>
>
>
> I want to use Person with assertBehaviour equality…
>
>
>
> Thanks
>
>
>
> --zoly
>
>
>
>
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>


-- 
 Edson Tirelli
 JBoss Drools Core Development
 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/20090223/0580366e/attachment.html 


More information about the rules-users mailing list