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

Examples of org.hibernate.validator.internal.engine.messageinterpolation.parser.TokenIterator.nextInterpolationTerm()


  private String interpolateBundleMessage(String message, ResourceBundle bundle, Locale locale, boolean recursive)
      throws MessageDescriptorFormatException {
    TokenCollector tokenCollector = new TokenCollector( message, InterpolationTermType.PARAMETER );
    TokenIterator tokenIterator = new TokenIterator( tokenCollector.getTokenList() );
    while ( tokenIterator.hasMoreInterpolationTerms() ) {
      String term = tokenIterator.nextInterpolationTerm();
      String resolvedParameterValue = resolveParameter(
          term, bundle, locale, recursive
      );
      tokenIterator.replaceCurrentInterpolationTerm( resolvedParameterValue );
    }
View Full Code Here


  private String interpolateBundleMessage(String message, ResourceBundle bundle, Locale locale, boolean recursive)
      throws MessageDescriptorFormatException {
    TokenCollector tokenCollector = new TokenCollector( message, InterpolationTermType.PARAMETER );
    TokenIterator tokenIterator = new TokenIterator( tokenCollector.getTokenList() );
    while ( tokenIterator.hasMoreInterpolationTerms() ) {
      String term = tokenIterator.nextInterpolationTerm();
      String resolvedParameterValue = resolveParameter(
          term, bundle, locale, recursive
      );
      tokenIterator.replaceCurrentInterpolationTerm( resolvedParameterValue );
    }
View Full Code Here

  @Test(expectedExceptions = IllegalStateException.class)
  public void testNextInterpolationTermWithoutCallingHasMoreInterpolationTerms() throws Exception {
    TokenCollector tokenCollector = new TokenCollector( "foo", InterpolationTermType.PARAMETER );
    TokenIterator tokenIterator = new TokenIterator( tokenCollector.getTokenList() );
    tokenIterator.nextInterpolationTerm();
  }

  @Test
  public void testMessageDescriptorWithoutParameter() throws Exception {
    String message = "this message has no parameter";
View Full Code Here

    String message = "{foo} {bar}";
    TokenCollector tokenCollector = new TokenCollector( message, InterpolationTermType.PARAMETER );
    TokenIterator tokenIterator = new TokenIterator( tokenCollector.getTokenList() );

    assertTrue( tokenIterator.hasMoreInterpolationTerms(), "There should be a term" );
    assertEquals( tokenIterator.nextInterpolationTerm(), "{foo}", "{foo} should be the first term" );

    assertTrue( tokenIterator.hasMoreInterpolationTerms(), "There should be a term" );
    assertEquals( tokenIterator.nextInterpolationTerm(), "{bar}", "{bar} should be the second term" );

    assertFalse( tokenIterator.hasMoreInterpolationTerms(), "There should be no more interpolation terms" );
View Full Code Here

    assertTrue( tokenIterator.hasMoreInterpolationTerms(), "There should be a term" );
    assertEquals( tokenIterator.nextInterpolationTerm(), "{foo}", "{foo} should be the first term" );

    assertTrue( tokenIterator.hasMoreInterpolationTerms(), "There should be a term" );
    assertEquals( tokenIterator.nextInterpolationTerm(), "{bar}", "{bar} should be the second term" );

    assertFalse( tokenIterator.hasMoreInterpolationTerms(), "There should be no more interpolation terms" );
  }

  @Test
View Full Code Here

  private String interpolateBundleMessage(String message, ResourceBundle bundle, Locale locale, boolean recursive)
      throws MessageDescriptorFormatException {
    TokenCollector tokenCollector = new TokenCollector( message, InterpolationTermType.PARAMETER );
    TokenIterator tokenIterator = new TokenIterator( tokenCollector.getTokenList() );
    while ( tokenIterator.hasMoreInterpolationTerms() ) {
      String term = tokenIterator.nextInterpolationTerm();
      String resolvedParameterValue = resolveParameter(
          term, bundle, locale, recursive
      );
      tokenIterator.replaceCurrentInterpolationTerm( resolvedParameterValue );
    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.