java.lang.Object
org.hibernate.validator.internal.engine.messageinterpolation.parser.TokenIterator

public class TokenIterator extends Object
Allows to iterate over a list of message tokens and replace parameters.
Author:
Hardy Ferentschik
  • Constructor Details

    • TokenIterator

      public TokenIterator(List<Token> tokens)
  • Method Details

    • hasMoreInterpolationTerms

      public boolean hasMoreInterpolationTerms() throws MessageDescriptorFormatException
      Called to advance the next interpolation term of the message descriptor. This message can be called multiple times. Once it returns false all interpolation terms have been processed and getInterpolatedMessage() can be called.
      Returns:
      Returns true in case there are more message parameters, false otherwise.
      Throws:
      MessageDescriptorFormatException - in case the message descriptor is invalid
    • nextInterpolationTerm

      public String nextInterpolationTerm()
      Returns:
      Returns the next interpolation term
    • replaceCurrentInterpolationTerm

      public void replaceCurrentInterpolationTerm(String replacement)
      Replaces the current interpolation term with the given string.
      Parameters:
      replacement - The string to replace the current term with.
    • getInterpolatedMessage

      public String getInterpolatedMessage()