<div dir="ltr">Awesome! Thank you! :-)</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Feb 26, 2014 at 5:11 PM, Edson Tirelli <span dir="ltr">&lt;<a href="mailto:ed.tirelli@gmail.com" target="_blank">ed.tirelli@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><br><div>   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:</div>
<div><br></div><div><span style="font-family:arial,sans-serif;font-size:13px">declare Here</span><br style="font-family:arial,sans-serif;font-size:13px">
<span style="font-family:arial,sans-serif;font-size:13px">    location: String @key</span><br style="font-family:arial,sans-serif;font-size:13px"><span style="font-family:arial,sans-serif;font-size:13px">end</span><br></div>

<div><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div><span style="font-family:arial,sans-serif;font-size:13px">   Generates a java class roughly equivalent to:</span></div><div><span style="font-family:arial,sans-serif;font-size:13px"><br>

</span></div><div><span style="font-family:arial,sans-serif;font-size:13px">public class Here implements Serializable {</span></div><div><span style="font-family:arial,sans-serif;font-size:13px">   private String location;</span></div>

<div><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div><span style="font-family:arial,sans-serif;font-size:13px">   public Here() {}</span></div><div><span style="font-family:arial,sans-serif;font-size:13px"> </span></div>

<div><span style="font-family:arial,sans-serif;font-size:13px">   public Here( String location ) {</span></div><div><span style="font-family:arial,sans-serif;font-size:13px">      this.location = location;</span></div><div>

<span style="font-family:arial,sans-serif;font-size:13px">   }</span></div><div><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div><span style="font-family:arial,sans-serif;font-size:13px">   public String getLocation() { return location; }</span></div>

<div><span style="font-family:arial,sans-serif;font-size:13px">   public void setLocation(String location) { this.location = location; }</span></div><div><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div>

<div><span style="font-family:arial,sans-serif;font-size:13px">   // generates a toString()</span></div><div><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div><span style="font-family:arial,sans-serif;font-size:13px">   // generates a hashCode()/equals() method that use the location&#39;s hashcode()/equals() </span></div>

<div><span style="font-family:arial,sans-serif;font-size:13px">}</span></div><div><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div><span style="font-family:arial,sans-serif;font-size:13px">   I did this from memory, but it is pretty much all it does. Nothing complex there, just a javabean really.</span></div>

<div><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div><span style="font-family:arial,sans-serif;font-size:13px">   The difference to not using @key is that the hashCode()/equals() methods would not take &quot;location&quot; in consideration, and in this case, since there are no other attributes, would then rely on system identity.</span></div>

<div><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div><span style="font-family:arial,sans-serif;font-size:13px">   Edson</span></div><div><span style="font-family:arial,sans-serif;font-size:13px"><br>

</span></div><div><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">

On Wed, Feb 26, 2014 at 2:23 PM, profversaggi <span dir="ltr">&lt;<a href="mailto:profversaggi@gmail.com" target="_blank">profversaggi@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

I was looking for something along the lines of a method of inspecting the<br>
resulting code of any arbitrary @key declarations I might want to deploy. Is<br>
there such a way?<br>
<br>
<br><span class="HOEnZb"><font color="#888888">
<br>
--<br>
View this message in context: <a href="http://drools.46999.n3.nabble.com/key-declarations-for-a-type-What-s-under-the-hood-tp4028343p4028346.html" target="_blank">http://drools.46999.n3.nabble.com/key-declarations-for-a-type-What-s-under-the-hood-tp4028343p4028346.html</a><br>


<div><div>Sent from the Drools: User forum mailing list archive at Nabble.com.<br>
_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org" target="_blank">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
</div></div></font></span></blockquote></div><span class="HOEnZb"><font color="#888888"><br><br clear="all"><div><br></div>-- <br><div dir="ltr">  Edson Tirelli<br>  Principal Software Engineer <div>  Red Hat Business Systems and Intelligence Group<br>
<br></div></div>
</font></span></div>
<br>_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div dir="ltr">#########################################################<br>
Matthew R. Versaggi, President &amp; CEO<br>Versaggi Information Systems, Inc.<br>Adjunct Professor of eBusiness DePaul University<br>Email: mailto:<a href="mailto:matt@versaggi.com" target="_blank">matt@versaggi.com</a>, <a href="mailto:ProfVersaggi@gmail.com" target="_blank">ProfVersaggi@gmail.com</a><br>
M: 630-292-8422 <br>LinkedIn:  <a href="http://www.linkedin.com/in/versaggi" target="_blank">http://www.linkedin.com/in/versaggi</a><br>######################################################### <br></div>
</div>