All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.deliveredtechnologies.rulebook.model.runner.RuleBookRunner4PojoClasses Maven / Gradle / Ivy

There is a newer version: 0.12
Show newest version
package com.deliveredtechnologies.rulebook.model.runner;

import com.deliveredtechnologies.rulebook.Result;
import com.deliveredtechnologies.rulebook.model.RuleBook;
import com.deliveredtechnologies.rulebook.model.rulechain.cor.CoRRuleBook;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.List;

/**
 * Runs a List of POJO Rules as a RuleBook.
 */
public class RuleBookRunner4PojoClasses extends AbstractRuleBookRunner {

  private static Logger LOGGER = LoggerFactory.getLogger(RuleBookRunner.class);

  private List> _pojoRules;
  private Class _prototypeClass;

  @SuppressWarnings("unchecked")
  private Result _result = new Result(null);

  /**
   * Creates a new RuleBookRunner using the specified POJO Rules and the default RuleBook.
   * @param pojoRules the POJO Rule classes used in the RuleBook
   */
  public RuleBookRunner4PojoClasses(List> pojoRules) {
    this(CoRRuleBook.class, pojoRules);
  }

  /**
   * Creates a new RuleBookRunner using the specified POJO Rules and the supplied RuleBook.
   * @param ruleBookClass the RuleBook type to use as a delegate for the RuleBookRunner
   * @param pojoRules     the package to scan for POJO rules
   */
  public RuleBookRunner4PojoClasses(Class ruleBookClass, List> pojoRules) {
    super(ruleBookClass);
    _prototypeClass = ruleBookClass;
    _pojoRules = pojoRules;
  }

  /**
   * Gets the POJO rules to be used in the RuleBook.
   * @return  The List of the supplied POJO Rules
   */
  protected List> getPojoRules() {
    return _pojoRules;
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy