|
Hi Ali: Yes, you are right! But in Drools’ user guide,
it said this: Field constraints place constraints on the
Fact objects for the rule engine to match/select out of working memory. They
work comparing/evaluating "field" values from the fact object
instances. A "field" is not a field in the
sense of a public or private member of a class. A field is an accessible
method. If your model objects follow the java bean pattern, then fields are
exposed using "getXXX" or "isXXX" methods (these are
methods that take no arguments, and return something). You can access fields
either by using the bean-name convention (so "getType" can be
accessed as "type"). For example, refering to our Cheese class,
the following : Cheese(type == ...) uses the getType() method on the a cheese
instance. You can also access non getter methods, like "toString()"
on the Object for instance (in which case, you do Cheese(toString == ..) - you
use the full name of the method with correct capitalisation, but not brackets).
Do please make sure that you are accessing methods that take no parameters, and
are in-fact "accessors" (as in, they don't change the state of the
object in a way that may effect the rules - remember that the rule engine
effectively caches the results of its matching inbetween invocations to make it
faster). But I find it couldn’t work
at all! Do I have a wrong understand? Do you have some thoughts? Thanks! 发件人: Ali Abdel-Aziz Ali
[mailto:[EMAIL PROTECTED] Hi zhang, rule "Your
First Rule" end On Hi all: I am a new comer to Drools. After I read the user guide, and I've write
my HelloWorld, but I got the error like this 'Unable to create Field Extractor', when I
use getXXX function name nor xxxx variable name. BTW, my IDE is eclipse. This is my code and rule: Code: package com.sample; public class RuleTest { public int name; public int getName(){ return name ; } } Rule: #created on: package rules import
com.sample.RuleTest; rule "Your
First Rule" when RuleTest(getName == 1) #conditions then #actions
end
|
- [drools-user] Unable to create Field Extractor 张茂森
- Re: [drools-user] Unable to create Field Extractor Ali Abdel-Aziz Ali
- RE: [drools-user] Unable to create Field Extra... 张茂森
