Class DrlHeaderCustomRuleDecorator
java.lang.Object
ch.tocco.nice2.optional.drools.api.util.DrlHeaderCustomRuleDecorator
- All Implemented Interfaces:
- CustomRuleDecorator
A custom rule decorator that optionally prepends a package statement and a header to
 a given rule. It's designed to be used in conjunction with Spring beans:
 
 @Bean
 public Subject educationrequirementSubject() throws MalformedURLException {
     Subject bean = new Subject();
     bean.setId("my-subject");
     bean.setPackagePrefix("my.pkg");
     bean.setModule(currentModule());
     bean.addFormat(new Subject.Format()
         .setType(RuleSource.Type.DRL)
         .setCustomRuleDecorator(new DrlHeaderCustomRuleDecorator(findModelResource("drools/custom-rule-header.drl"))));
     return bean;
 }
 - 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionorg.kie.api.io.Resourcedecorate(org.kie.api.io.Resource resource, RuleSource source, String packageName) Decorate a custom rule.Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ch.tocco.nice2.optional.drools.api.CustomRuleDecoratorpriority
- 
Constructor Details- 
DrlHeaderCustomRuleDecorator
 
- 
- 
Method Details- 
decoratepublic org.kie.api.io.Resource decorate(org.kie.api.io.Resource resource, RuleSource source, String packageName) throws IOException Description copied from interface:CustomRuleDecoratorDecorate a custom rule.- Specified by:
- decoratein interface- CustomRuleDecorator
- Parameters:
- resource- The Drools `Resource` that is being loaded.
- source- The- RuleSourcethe rules are being loaded from.
- packageName- A package name to be used for the rules.
- Returns:
- A Drools `Resource` for the decorated custom rules.
- Throws:
- IOException- If an I/O error occurs.
 
 
-