[jboss-jira] [JBoss JIRA] Closed: (JBRULES-1439) Property Name inconsistent on RHS
Mark Proctor (JIRA)
jira-events at lists.jboss.org
Wed Mar 12 00:06:58 EDT 2008
[ http://jira.jboss.com/jira/browse/JBRULES-1439?page=all ]
Mark Proctor closed JBRULES-1439.
---------------------------------
Resolution: Rejected
Assignee: Mark Proctor
no java and mvel use different notation for accessors.
you've left the field public, which means that java can access it and you use an upper char for the first field name. Java can also use the getter accessor methods.
Where as mvel provides a short cut to accessors. so
var.field
is actually calling var.getField()
> 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
More information about the jboss-jira
mailing list