[
http://jira.jboss.com/jira/browse/JBRULES-1439?page=comments#action_12402358 ]
greywind commented on JBRULES-1439:
-----------------------------------
Just one more question. That means that in a Java consequence we cannot use Java Bean
Property type Accessors. MVEL does allow just that. Would it be a valid feature
enhancement to have Java Bean Property Accessors in the Java consequence?
Property Name inconsistent on RHS
---------------------------------
Key: JBRULES-1439
URL:
http://jira.jboss.com/jira/browse/JBRULES-1439
Project: JBoss Drools
Issue Type: Bug
Security Level: Public(Everyone can see)
Components: Drl Parser/Builder
Affects Versions: 4.0.4
Reporter: greywind
Assigned To: Mark Proctor
Priority: Minor
I apologize right from the start if this is a know thing, but I couldn't find it in
the Documentation or the mailing Lists:
public class Settlement
{
public String InstrumentType,InstrumentName;
public String getInstrumentType() {
return InstrumentType;
}
public void setInstrumentType(String instrumentType) {
InstrumentType = instrumentType;
}
public String getInstrumentName() {
return InstrumentName;
}
public void setInstrumentName(String instrumentName) {
InstrumentName = instrumentName;
}
}
The following Role leads to an error during compilation as the Property instrumentName
can not be found on the RHS. in the LHS it is found:
rule "TestEntity"
//dialect "mvel"
when
$s : Settlement(instrumentType == "BOND", name : instrumentName)
#conditions
then
System.out.println("Found: " + $s.instrumentName);
end
It seems that in the java dialect the LHS follows java bean notation (property start with
lower case) on the RHS not. I have to specify the property with UpperCamelCase on RHS to
make it work:
rule "TestEntity"
//dialect "mvel"
when
$s : Settlement(instrumentType == "BOND", name : instrumentName)
#conditions
then
System.out.println("Found: " + $s.InstrumentName);
end
the MVEL dialect on the other hand handles this as expected. the property is
LowerCamelCase on both sides:
rule "TestEntity"
dialect "mvel"
when
$s : Settlement(instrumentType == "BOND", name : instrumentName)
#conditions
then
System.out.println("Found: " + $s.instrumentName);
end
I would expect that the java dialect should work the same way here, should it not?
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira