rule.rule.vm Maven / Gradle / Ivy
package $package_name;
import com.zlyx.easy.drools.builder.RuleBuilder;
import com.zlyx.easy.drools.executor.RuleExecutor;
import com.zlyx.easy.drools.validate.RuleValidator;
$import_package
public class $class_name extends RuleExecutor<$rule_context_domain> {
/**
* $method_name
*
* @param context context
*
* @throws Exception
*/
public void $method_name($rule_context_domain context) {
$method_body
}
@Override
public $rule_context_domain initContext() throws Exception {
return new $rule_context_domain();
}
public static void main(String[] args) throws Exception {
RuleBuilder.RuleBody ruleBody = RuleBuilder.newBuilder("$rule_name");
ruleBody.when("$ctx: $rule_context_domain();"); // 规则条件
ruleBody.then($class_name .class, "$method_name"); // 规则内容
//导入包
ruleBody.importClass($rule_context_domain .class);
ruleBody.importClass(Logger.class);
ruleBody.importClass(LoggerFactory.class);
//设置属性
ruleBody.props("message", "执行完成");
RuleValidator.validate(ruleBody, new $class_name());
}
}