com.deliveredtechnologies.rulebook.Decision 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;
import java.util.List;
import java.util.function.BiConsumer;
import java.util.function.BiFunction;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.function.Predicate;
/**
* A special type of rule that has a return type, which may be different from the type of input (Facts).
*/
@Deprecated
public interface Decision extends Rule {
//Overriding these methods for method chaining to work with this interface
@Override
Decision given(String name, T value);
@Override
Decision given(Fact... facts);
@Override
Decision given(List> facts);
@Override
Decision given(FactMap facts);
@Override
Decision givenUnTyped(FactMap facts);
@Override
Decision when(Predicate> test);
@Override
Decision then(Consumer> action);
/**
* The then method specifies the action taken if when()
evaluates to true.
* The execution of this 'then' takes precedence over then(Function)
if both exist.
*
* @param action the action to be performed
* @return the current Rule
object
*/
Decision then(BiConsumer, Result> action);
@Override
Decision using(String... factName);
@Override
Decision stop();
/**
* The getResult()
method returns the stored result from the Decision
* The value may be null.
*
* @return the result object
*/
U getResult();
/**
* The setResult()
method initializes the stored result; useful for aggregation/chaining of a result.
*
* @param result the instantiated result
*/
void setResult(Result result);
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy