com.rabbitmq.jms.parse.Evaluator Maven / Gradle / Ivy
/* Copyright (c) 2014-2020 VMware, Inc. or its affiliates. All rights reserved. */
package com.rabbitmq.jms.parse;
import java.util.Map;
/**
* An {@link Evaluator} will evaluate an expression.
*
* An evaluator takes a set of values (the environment) and evaluates an expression in it, returning a Result
.
* For example, it might evaluate a (previously given) boolean expression given a set of values assigned to variables.
*/
public interface Evaluator {
/**
* Evaluates the (given) expression with the env
ironment given.
* This call should not fail, provided {@link #evaluatorOk()} is true
.
* @param env - the values of the variables used when evaluating the expression
* @return the evaluated result: true or false
*/
boolean evaluate(Map env);
/**
* This call is idempotent.
* @return true
if the evaluator can run cleanly; false
otherwise
*/
boolean evaluatorOk();
/**
* This call is idempotent.
* @return null if evaluatorOk() is false; otherwise an error message denoting the type of failure to initialise.
*/
String getErrorMessage();
}