[rules-users] declaring attributes for an existing class

Neel neeleshdev at yahoo.co.in
Wed Aug 17 03:55:09 EDT 2011


I'm using drools 5.1.1. In drools expert document I found following in "Declaring Metadata for Existing Types" section:"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."
It says that additional fields can't be there in declaration for existing types. Are there other ways to achieve the same?
Thanks,Neel


What version of Drools are you using? 

AFAIK what you have done should work.

2011/8/17 Neel <neeleshdev at yahoo.co.in>

Hi,I've following class defined:
public class User {
	private String id;
	//get,set, equals & hashCode method are defined
}

If I add more attributes using declare syntax as below:declare User
    name : Stringend

it gives error "Error
 creating field accessors for 'User' for type 'User'". Is there a way, more attributes can be added in existing class using declare syntax? 

Alternatively, if a class is created by using only declare syntax, can we add equals/hasCode methods dynamically?

Thanks & Regards,Neel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20110817/e8afa50c/attachment.html 


More information about the rules-users mailing list