Class TokenEvaluator<T>

    • Constructor Detail

      • TokenEvaluator

        public TokenEvaluator()
    • Method Detail

      • getTargetType

        public abstract Class<?> getTargetType()
        Gets the type against which tokens can be evaluated in this implementation.
        Returns:
        the evaluation type
      • tokens

        public abstract Set<String> tokens​(T object)
        Gets the set of supported token for the given object.
        Parameters:
        object - the object against which tokens may be evaluated
        Returns:
        the set of supported tokens
      • evaluate

        public abstract EvaluationResult evaluate​(T target,
                                                  CalculationFunctions functions,
                                                  String firstToken,
                                                  List<String> remainingTokens)
        Evaluates a token against a given object.
        Parameters:
        target - the object against which to evaluate the token
        functions - the calculation functions
        firstToken - the first token of the expression
        remainingTokens - the remaining tokens in the expression, possibly empty
        Returns:
        the result of the evaluation
      • invalidTokenFailure

        protected EvaluationResult invalidTokenFailure​(T object,
                                                       String token)
        Generates a failure result for an invalid token.
        Parameters:
        object - the object against which the failure occurred
        token - the invalid token
        Returns:
        the failure result
      • ambiguousTokenFailure

        protected EvaluationResult ambiguousTokenFailure​(T object,
                                                         String token)
        Generates a failure result for an ambiguous token.
        Parameters:
        object - the object against which the failure occurred.
        token - the ambiguous token
        Returns:
        the failure result