JBOSS Rule日记(二)

 

1. LHS表达式

a. 列(Column)

Cheese()

Cheese( type == "Stilton", price < 10 )  //type,price为类Cheese的属性,即type为"Stilton",price小于10的匹配成功)

cheapStilton : Cheese( type == "stilton", price < 10 ) //把满足规则的类对象实例化,这样别的规则可以引用,RHS也可以引用
b. 操作符(operator)
<,<=,>,>=,==,!=,matches,contains,excudes
c. 支持的数据类型
numeric,date,string,boolean,enum,regexp
numeric支持的操作符号有:==,!=,>,<,>=,<=
date支持的操作有:==, !=, >, <, >=, <=
string支持操作有:==, !=
boolean支持的操作:true, false
matches支持java正则表达,例子:Cheese( type matches "(Buffulo)?//S*Mozerella" )
contains操作:CheeseCounter( cheeses contains "stilton" )???cheeses怎么来的
excludes操作:CheeseCounter( cheeses excludes "cheddar" )
d. 值绑定
Person( likes : favouriteCheese )
Cheese( type == likes )
likes是定义的变量,favouriteCheese是类型,Person( likes : favouriteCheese )只要是favouriteCheese的实例既可满足条件
用contains绑定
$stilton : Cheese( type == "stilton" )
Cheesery( cheeses contains $stilton )
 

你可能感兴趣的:(JBOSS Rule日记(二))