실행 파트에서 현재 실행되는 규칙의 이름에 액세스

사전 정의된 변수를 사용하여 서술형 규칙의 실행 파트에서 현재 실행되는 규칙의 이름에 액세스할 수 있습니다.

사전 정의된 변수를 사용하여 서술형 규칙의 실행 파트에서 현재 실행되는 규칙의 이름에 액세스할 수 있습니다. 변수의 유형은 String이며 해당 규칙의 이름이 포함되어 있습니다.

참고: 이 변수를 따옴표로 묶을 필요가 없습니다.

규칙의 정의 또는 조건 파트에서는 이 변수를 사용할 수 없습니다. 런타임 시 이 변수에 현재 실행되는 규칙의 비즈니스 이름이 지정됩니다.

이 변수를 사용하는 예제 그림입니다.

if
	the age of the customer is less than 18
then
	print the message "A 5% discount has been applied to policy: " + the name of this rule; 

이 사전 정의된 변수에 대한 참조는 ilog.rules.brl.IlrNameUtil.getBusinessIdentifier(?instance.ruleName)로 변환됩니다.

rule Young_Customer_Policy {
property status = "new";
when {
      customer balsample.Customer();
      evaluate (customer.age < 18);
} 
then {
      balsample.Customer.printMessage(
      ("A 5% discount has been applied to policy: " +
      ilog.rules.brl.IlrNameUtil.getBusinessIdentifier(?instance.ruleName))
      ); 
} 
}