Class EvaluationResult


  • public final class EvaluationResult
    extends Object
    The result of a TokenEvaluator evaluating an expression against an object.

    The result contains the result of the evaluation and the remaining tokens in the expression.

    • Method Detail

      • success

        public static EvaluationResult success​(Object value,
                                               List<String> remainingTokens)
        Creates the result of successfully evaluating a token against an object.
        Parameters:
        value - the result of evaluating the expression against the object
        remainingTokens - the tokens remaining in the expression after evaluation
        Returns:
        the result of successfully evaluating a token against an object
      • failure

        public static EvaluationResult failure​(String message,
                                               Object... messageValues)
        Creates a result for an unsuccessful evaluation of an expression.
        Parameters:
        message - the error message
        messageValues - values substituted into the error message. See Messages.format(String, Object...) for details
        Returns:
        the result of an unsuccessful evaluation of an expression
      • of

        public static EvaluationResult of​(Result<?> result,
                                          List<String> remainingTokens)
        Creates the result of evaluating a token against an object.
        Parameters:
        result - the result of evaluating the expression against the object
        remainingTokens - the tokens remaining in the expression after evaluation
        Returns:
        the result of evaluating a token against an object
      • getResult

        public Result<?> getResult()
        Returns the result of evaluating the expression against the object.
        Returns:
        the result of evaluating the expression against the object
      • getRemainingTokens

        public List<String> getRemainingTokens()
        Returns the tokens remaining in the expression after evaluation.
        Returns:
        the tokens remaining in the expression after evaluation
      • isComplete

        public boolean isComplete()
        Returns true if evaluation of the whole expression is complete.

        This occurs if the evaluation failed or all tokens in the expression have been consumed.

        Returns:
        returns true if evaluation of the whole expression is complete