Class EvaluationResult


  • public final class EvaluationResult
    extends java.lang.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 Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static EvaluationResult failure​(java.lang.String message, java.lang.Object... messageValues)
      Creates a result for an unsuccessful evaluation of an expression.
      java.util.List<java.lang.String> getRemainingTokens()
      Returns the tokens remaining in the expression after evaluation.
      Result<?> getResult()
      Returns the result of evaluating the expression against the object.
      boolean isComplete()
      Returns true if evaluation of the whole expression is complete.
      static EvaluationResult of​(Result<?> result, java.util.List<java.lang.String> remainingTokens)
      Creates the result of evaluating a token against an object.
      static EvaluationResult success​(java.lang.Object value, java.util.List<java.lang.String> remainingTokens)
      Creates the result of successfully evaluating a token against an object.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • success

        public static EvaluationResult success​(java.lang.Object value,
                                               java.util.List<java.lang.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​(java.lang.String message,
                                               java.lang.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,
                                          java.util.List<java.lang.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 java.util.List<java.lang.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