5. Working Memory 24 The from-class declaration, by itself, will create slots that correspond to JavaBeans properties. If you also use include-variables , like this: Jess> (deftemplate Account (declare (from-class Account) (include-variables TRUE)) then public member variables of the class are used to define additional slots. 5.3.2. Adding Java objects to working memory Once you've created an appropriate template, you can add some Java objects to working memory, automatically creating shadow facts to link them to Jess. Continuing with our Account example, imagine that you want to create an Account , and you want to add this object to working memory because rules will be working with it. Then all you need to do is: Jess> (bind ?a (new Account)) <Java-Object:Account> Jess> (add ?a) <Fact-0> Jess> (facts) f-0 (MAIN::Account (balance 0.0) (class <Java-Object:java.lang.Class>) (OBJECT <Java-Object:Account>)) For a total of 1 facts in module MAIN. The
This is the end of the preview. Sign up
access the rest of the document.