That&#39;s a surprise! <br><br>I thought 5.2 added the feature (or at least was meant to)?!?<br><br><div class="gmail_quote">2011/8/17 Wolfgang Laun <span dir="ltr">&lt;<a href="mailto:wolfgang.laun@gmail.com">wolfgang.laun@gmail.com</a>&gt;</span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Adding fields to a Java class does not work in 5.2.0 and earlier. With the upcoming 5.3.0 you can do<br>

<br>

import some.User<br>

<br>

declare NamedUser extends User<br>

   name : String<br>

end<br><font color="#888888">

<br>
-W<br>
<br><br></font><div class="gmail_quote"><div class="im">2011/8/17 Neel <span dir="ltr">&lt;<a href="mailto:neeleshdev@yahoo.co.in" target="_blank">neeleshdev@yahoo.co.in</a>&gt;</span><br></div><blockquote class="gmail_quote" style="border-left:1px solid rgb(204, 204, 204);margin:0pt 0pt 0pt 0.8ex;padding-left:1ex">
<div class="im">
<table border="0" cellpadding="0" cellspacing="0"><tbody><tr><td style="font-family:inherit;font-style:inherit;font-variant:inherit;font-weight:inherit;font-size:inherit;line-height:inherit;font-size-adjust:inherit;font-stretch:inherit" valign="top">

I&#39;m using drools 5.1.1. In drools expert document I found following in &quot;<span style="font-family:Helvetica;font-size:14px;color:rgb(74, 93, 117)"><b>Declaring Metadata for Existing Types&quot;</b></span> section:<div>

&quot;<span style="font-family:Helvetica;font-size:10px">Drools allows the declaration of metadata attributes for existing types in the same way as when declaring metadata attributes for new fact types. The only difference is that there are no fields in that declaration.&quot;</span></div>

<div><font face="Helvetica" size="2"><span style="font-size:10px"><br></span></font></div><div><font face="Helvetica" size="2"><span style="font-size:10px"><span style="font-family:arial;font-size:13px">It says that additional fields can&#39;t be there in declaration for existing types. Are there other ways to achieve the same?</span></span></font></div>

<div><font face="Helvetica" size="2"><span style="font-size:10px"><font face="arial" size="3"><span style="font-size:13px"><br></span></font></span></font></div><div><font face="Helvetica" size="2"><span style="font-size:10px"><font face="arial" size="3"><span style="font-size:13px">Thanks,</span></font></span></font></div>

<div><font face="Helvetica" size="2"><span style="font-size:10px"><font face="arial" size="3"><span style="font-size:13px">Neel<font color="#888888"><br></font></span></font></span></font><div><br><blockquote style="border-left:2px solid rgb(16, 16, 255);margin-left:5px;padding-left:5px">

<br><div>What version of Drools are you using? <br><br>AFAIK what you have done should work.<br><br><div>2011/8/17 Neel <span dir="ltr">&lt;<a rel="nofollow" href="http://mc/compose?to=neeleshdev@yahoo.co.in" target="_blank">neeleshdev@yahoo.co.in</a>&gt;</span><br>


<blockquote style="border-left:1px solid rgb(204, 204, 204);margin:0pt 0pt 0pt 0.8ex;padding-left:1ex"><table border="0" cellpadding="0" cellspacing="0"><tbody><tr><td style="font-family:inherit;font-style:inherit;font-variant:inherit;font-weight:inherit;font-size:inherit;line-height:inherit;font-size-adjust:inherit;font-stretch:inherit" valign="top">

Hi,<div>I&#39;ve following class defined:</div>
<div><p style="margin:0px;font-family:Monaco;font-style:normal;font-variant:normal;font-weight:normal;font-size:11px;line-height:normal;font-size-adjust:none;font-stretch:normal"><span style="color:rgb(161, 0, 103)">public</span> <span style="color:rgb(161, 0, 103)">class</span> User {</p>


<p style="margin:0px;font-family:Monaco;font-style:normal;font-variant:normal;font-weight:normal;font-size:11px;line-height:normal;font-size-adjust:none;font-stretch:normal"><span style="white-space:pre-wrap">        </span><span style="color:rgb(161, 0, 103)">private</span> String <span style="color:rgb(39, 0, 206)">id</span>;</p>


<p style="margin:0px;font-family:Monaco;font-style:normal;font-variant:normal;font-weight:normal;font-size:11px;line-height:normal;font-size-adjust:none;font-stretch:normal;min-height:15px"><span style="white-space:pre-wrap">        </span>//get,set, equals &amp; hashCode method are defined</p>


<p style="margin:0px;font-family:Monaco;font-style:normal;font-variant:normal;font-weight:normal;font-size:11px;line-height:normal;font-size-adjust:none;font-stretch:normal">}</p><p style="margin:0px;font-family:Monaco;font-style:normal;font-variant:normal;font-weight:normal;font-size:11px;line-height:normal;font-size-adjust:none;font-stretch:normal">

</p><p style="margin:0px;font-family:Monaco;font-style:normal;font-variant:normal;font-weight:normal;font-size:11px;line-height:normal;font-size-adjust:none;font-stretch:normal"><br></p><p></p><p style="margin:0px;font-family:Monaco;font-style:normal;font-variant:normal;font-weight:normal;font-size:11px;line-height:normal;font-size-adjust:none;font-stretch:normal">


If I add more attributes using declare syntax as below:</p><span style="font-family:Monaco;font-size:11px"><p style="margin:0px">declare User</p><p style="margin:0px">
    name : String</p></span><p style="margin:0px;font-family:Monaco;font-style:normal;font-variant:normal;font-weight:normal;font-size:11px;line-height:normal;font-size-adjust:none;font-stretch:normal">
end</p><p style="margin:0px;font-family:Monaco;font-style:normal;font-variant:normal;font-weight:normal;font-size:11px;line-height:normal;font-size-adjust:none;font-stretch:normal"><br></p><p style="margin:0px;font-family:Monaco;font-style:normal;font-variant:normal;font-weight:normal;font-size:11px;line-height:normal;font-size-adjust:none;font-stretch:normal">


it gives error &quot;Error
 creating field accessors for &#39;User&#39; for type &#39;User&#39;&quot;. Is there a way, more attributes can be added in existing class using declare syntax? </p><p style="margin:0px;font-family:Monaco;font-style:normal;font-variant:normal;font-weight:normal;font-size:11px;line-height:normal;font-size-adjust:none;font-stretch:normal">


<br></p><p style="margin:0px;font-family:Monaco;font-style:normal;font-variant:normal;font-weight:normal;font-size:11px;line-height:normal;font-size-adjust:none;font-stretch:normal">Alternatively, if a class is created by using only declare syntax, can we add equals/hasCode methods dynamically?</p>

<p style="margin:0px;font-family:Monaco;font-style:normal;font-variant:normal;font-weight:normal;font-size:11px;line-height:normal;font-size-adjust:none;font-stretch:normal">
<br></p><p style="margin:0px;font-family:Monaco;font-style:normal;font-variant:normal;font-weight:normal;font-size:11px;line-height:normal;font-size-adjust:none;font-stretch:normal">Thanks &amp; Regards,</p>
<p style="margin:0px;font-family:Monaco;font-style:normal;font-variant:normal;font-weight:normal;font-size:11px;line-height:normal;font-size-adjust:none;font-stretch:normal">Neel</p></div></td></tr></tbody></table>
</blockquote></div></div><div><br></div></blockquote></div></div></td></tr></tbody></table><br></div><div class="im">_______________________________________________<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>
<br></div></blockquote></div><br>
<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>
<br></blockquote></div><br>