The declare results in a bean, with constructors according to what you
have written, with getters and setters, and methods overriding toText,
equals and hashCode.
-W
On 26/02/2014, profversaggi <profversaggi(a)gmail.com> wrote:
Is there any way to interrogate exactly, as in get a printed
representation
of what goes on under the hood for one of these type of declarations ?
As an example: (as per the docs) for a declared type like the following:
declare Person
*firstName : String @key*
*lastName : String @key*
age : int
end
The compiler will implicitly generate 3 constructors: one without
parameters,
one with the @key fields, and one with all fields.
Person() // parameterless constructor
Person( String firstName, String lastName )
Person( String firstName, String lastName, int age )
...creating an instance using the @key constructor
/Person person = new Person( "John", "Doe" );/
****************
So lets say I do the following:
declare Here
location: String @key
end
I understand that it does the above, but it *also* lets me do this as well:
* Here here = new Here("kitchen");
System.out.println( here );
System.out.println( here.getLocation(); );
$lh : Here (location == "kitchen")
System.out.println( "You are in the " + $lh.getLocation() );*
And get ...
*Here( location=kitchen )
kitchen
You are in the kitchen*
... from various rules I've created ... so there is a lot going on under
the
hood, I just want to get a complete inventory of what that is and how I
inspect it for more complex type declarations.
Any ideas?
-matt
--
View this message in context:
http://drools.46999.n3.nabble.com/key-declarations-for-a-type-What-s-unde...
Sent from the Drools: User forum mailing list archive at
Nabble.com.
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users