com.deliveredtechnologies.rulebook.model.AuditableRule Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of rulebook-core Show documentation
Show all versions of rulebook-core Show documentation
A simple and intuitive rules abstraction for Java
package com.deliveredtechnologies.rulebook.model;
import com.deliveredtechnologies.rulebook.NameValueReferable;
import com.deliveredtechnologies.rulebook.NameValueReferableMap;
import com.deliveredtechnologies.rulebook.NameValueReferableTypeConvertibleMap;
import com.deliveredtechnologies.rulebook.Result;
import com.deliveredtechnologies.rulebook.RuleState;
import java.util.List;
import java.util.Optional;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
import java.util.function.Predicate;
/**
* Rule decorator that provides auditing when added to an {@link Auditor}.
*/
public class AuditableRule implements Rule, Auditable {
private Rule _rule;
private String _name = getClass().getSimpleName();
private Auditor _auditor;
public AuditableRule(Rule rule) {
_rule = rule;
}
public AuditableRule(Rule rule, String name) {
this(rule);
_name = name;
}
@Override
public void addFacts(NameValueReferable... facts) {
_rule.addFacts(facts);
}
@Override
public void addFacts(NameValueReferableMap facts) {
_rule.addFacts(facts);
}
@Override
public void setFacts(NameValueReferableMap facts) {
_rule.setFacts(facts);
}
@Override
public void setCondition(Predicate> condition) {
_rule.setCondition(condition);
}
@Override
public void setRuleState(RuleState ruleState) {
_rule.setRuleState(ruleState);
}
@Override
public void addAction(Consumer> action) {
_rule.addAction(action);
}
@Override
public void addAction(BiConsumer, Result> action) {
_rule.addAction(action);
}
@Override
public void addFactNameFilter(String... factNames) {
_rule.addFactNameFilter(factNames);
}
@Override
public NameValueReferableMap getFacts() {
return _rule.getFacts();
}
@Override
public Predicate> getCondition() {
return _rule.getCondition();
}
@Override
public RuleState getRuleState() {
return _rule.getRuleState();
}
@Override
public List
© 2015 - 2025 Weber Informatics LLC | Privacy Policy