Awesome! Thank you! :-)


On Wed, Feb 26, 2014 at 5:11 PM, Edson Tirelli <ed.tirelli@gmail.com> wrote:

   Drools bytecode generates these beans without generating java source code (if you are using the declare, not the data modeller). Having said that, it is very simple:

declare Here
    location: String @key
end

   Generates a java class roughly equivalent to:

public class Here implements Serializable {
   private String location;

   public Here() {}
 
   public Here( String location ) {
      this.location = location;
   }

   public String getLocation() { return location; }
   public void setLocation(String location) { this.location = location; }

   // generates a toString()

   // generates a hashCode()/equals() method that use the location's hashcode()/equals() 
}

   I did this from memory, but it is pretty much all it does. Nothing complex there, just a javabean really.

   The difference to not using @key is that the hashCode()/equals() methods would not take "location" in consideration, and in this case, since there are no other attributes, would then rely on system identity.

   Edson





On Wed, Feb 26, 2014 at 2:23 PM, profversaggi <profversaggi@gmail.com> wrote:
I was looking for something along the lines of a method of inspecting the
resulting code of any arbitrary @key declarations I might want to deploy. Is
there such a way?



--
View this message in context: http://drools.46999.n3.nabble.com/key-declarations-for-a-type-What-s-under-the-hood-tp4028343p4028346.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users



--
  Edson Tirelli
  Principal Software Engineer 
  Red Hat Business Systems and Intelligence Group


_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users



--
#########################################################
Matthew R. Versaggi, President & CEO
Versaggi Information Systems, Inc.
Adjunct Professor of eBusiness DePaul University
Email: mailto:matt@versaggi.com, ProfVersaggi@gmail.com
M: 630-292-8422 
LinkedIn:  http://www.linkedin.com/in/versaggi
#########################################################