Interface LhsBuilder<C extends RuntimeContext<C>>

Type Parameters:
C - the type of the RuntimeContext of the builder

public interface LhsBuilder<C extends RuntimeContext<C>>
The LhsBuilder interface is used to build the left-hand side (LHS) of a rule.
  • Method Details

    • execute

      RuleSetBuilder<C> execute(String literalRhs)

      Terminates current rule builder with the provided RHS action

      Parameters:
      literalRhs - RHS action as Java code
      Returns:
      returns the current ruleset builder
    • execute

      RuleSetBuilder<C> execute()

      Terminates current rule builder as a rule without action.

      Returns:
      returns the current ruleset builder
    • execute

      RuleSetBuilder<C> execute(Consumer<RhsContext> consumer)

      Terminates current rule builder with the provided RHS action

      Parameters:
      consumer - RHS
      Returns:
      returns the current ruleset builder
    • where

      default LhsBuilder<C> where(String... expressions)
      Adds one or more condition expressions to the current LhsBuilder.
      Parameters:
      expressions - the condition expressions to add
      Returns:
      the current LhsBuilder
    • where

      LhsBuilder<C> where(String expression, double complexity)
      Adds a condition expression to the current LhsBuilder.
      Parameters:
      expression - the condition expression to add
      complexity - the complexity of the condition expression
      Returns:
      the current LhsBuilder
    • where

      LhsBuilder<C> where(Predicate<Object[]> predicate, double complexity, String... references)
      Adds a condition to the current LhsBuilder with the provided predicate, complexity, and references.
      Parameters:
      predicate - the predicate to add as a condition
      complexity - the complexity of the condition
      references - the field references, e.g., ["$a.id", "$b.code.value", "$c"], in the same order and of the same types as required by the predicate
      Returns:
      the current LhsBuilder
    • where

      default LhsBuilder<C> where(Predicate<Object[]> predicate, String... references)
      Adds a condition to the current LhsBuilder with the provided predicate, default complexity, and references.
      Parameters:
      predicate - the predicate to add as a condition
      references - the field references, e.g., ["$a.id", "$b.code.value", "$c"], in the same order and of the same types as required by the predicate
      Returns:
      the current LhsBuilder
    • where

      LhsBuilder<C> where(ValuesPredicate predicate, double complexity, String... references)
      Adds a condition to the current LhsBuilder with the provided predicate, complexity, and field references.
      Parameters:
      predicate - the predicate to add as a condition
      complexity - the complexity of the condition
      references - the field references, e.g., ["$a.id", "$b.code.value", "$c"], in the same order and of the same types as required by the predicate
      Returns:
      the current LhsBuilder
    • where

      default LhsBuilder<C> where(ValuesPredicate predicate, String... references)
      Adds a condition to the current LhsBuilder with the provided predicate and field references.
      Parameters:
      predicate - the predicate to add as a condition
      references - the field references, e.g., ["$a.id", "$b.code.value", "$c"], in the same order and of the same types as required by the predicate
      Returns:
      the current LhsBuilder
    • addFact

      default LhsBuilder<C> addFact(String name, String type)
      A shorthand and fluent version of the addFactDeclaration(String, String) method.
      Parameters:
      name - the name of the fact declaration, e.g. "$customer"
      type - the logical type of the fact, see the Type documentation on the logical types
      Returns:
      this builder
    • addFactDeclaration

      NamedType addFactDeclaration(String name, String type)
      Adds a fact declaration to the current LhsBuilder.
      Parameters:
      name - the name of the fact declaration, e.g. "$customer"
      type - the logical type of the fact, see the Type documentation on the logical types
      Returns:
      the NamedType representing the fact declaration
    • addFact

      default LhsBuilder<C> addFact(String name, Type<?> type)
      A shorthand and fluent version of the addFactDeclaration(String, Type) method.
      Parameters:
      name - the name of the fact declaration, e.g. "$customer"
      type - the type of the fact declaration
      Returns:
      this builder
    • addFactDeclaration

      NamedType addFactDeclaration(String name, Type<?> type)
      Adds a fact declaration to the current LhsBuilder.
      Parameters:
      name - the name of the fact declaration, e.g. "$customer"
      type - the type of the fact declaration
      Returns:
      the NamedType representing the fact declaration
      Throws:
      NullPointerException - if either the name or type parameter is null
    • addFact

      default LhsBuilder<C> addFact(String name, Class<?> type)
      A shorthand and fluent version of the addFactDeclaration(String, Class) method.
      Parameters:
      name - the name of the fact declaration, e.g. "$customer"
      type - the type of the fact declaration
      Returns:
      this builder
    • addFactDeclaration

      NamedType addFactDeclaration(String name, Class<?> type)
      Adds a fact declaration to the current LhsBuilder.
      Parameters:
      name - the name of the fact declaration, e.g. "$customer"
      type - the type of the fact declaration
      Returns:
      the NamedType representing the fact declaration