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 Description TokenIterator(List<Token> tokens)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetInterpolatedMessage()booleanhasMoreInterpolationTerms()Called to advance the next interpolation term of the message descriptor.StringnextInterpolationTerm()voidreplaceCurrentInterpolationTerm(String replacement)Replaces the current interpolation term with the given string.
-
-
-
Method Detail
-
hasMoreInterpolationTerms
public boolean hasMoreInterpolationTerms() throws MessageDescriptorFormatExceptionCalled to advance the next interpolation term of the message descriptor. This message can be called multiple times. Once it returnsfalseall interpolation terms have been processed andgetInterpolatedMessage()can be called.- Returns:
- Returns
truein case there are more message parameters,falseotherwise. - 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()
-
-