Skip to content

Latest commit

 

History

History
40 lines (29 loc) · 766 Bytes

functions.adoc

File metadata and controls

40 lines (29 loc) · 766 Bytes

Functions

语法

drools reference functions

示例

testFunctions.drl
package org.drools.examples.functions;

function String sayHello(String msg) {
  return "Hello " + msg + "!";
}

rule "using a function"
  when
    eval(true)
  then
    System.out.println(sayHello("TEST"));
end
Example_Functions.java
KieServices ks = KieServices.Factory.get();
KieContainer kContainer = ks.getKieClasspathContainer();
KieSession kSession = kContainer.newKieSession("ksession-rules-functions");
kSession.fireAllRules();
kSession.dispose();