org.hibernate.validator.internal.engine.messageinterpolation.parser

## Class TokenIterator

- 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 Summary

    Constructors
    Constructor and Description
    `TokenIterator(List<Token> tokens)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `String` | `getInterpolatedMessage()`
    `boolean` | `hasMoreInterpolationTerms()` Called to advance the next interpolation term of the message descriptor.
    `String` | `nextInterpolationTerm()`
    `void` | `replaceCurrentInterpolationTerm(String replacement)` Replaces the current interpolation term with the given string.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### TokenIterator

          public TokenIterator(List<Token> tokens)

  - ### Method Detail

    - #### 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()

Copyright © 2007-2014 Red Hat, Inc. All Rights Reserved