Package com.em.validation.client.messages

Examples of com.em.validation.client.messages.MessageResolver


    return this.interpolate(messageTemplate, context, Locale.getDefault());
  }

  @Override
  public String interpolate(String messageTemplate, Context context, Locale locale) {
    MessageResolver resolver = MessageResolver.INSTANCE;
   
    String template = messageTemplate;
    String output = template;
   
    //only need to get the localized version if and when the string starts and ends with { and } with no { or } in between.
    //"{java...thing.Class.message}" is localized
    //"{attribute} of {property} with {property}" is not localized
    if(template.startsWith("{") && template.endsWith("}") && !template.substring(1,template.length() - 1).contains("{") && !template.substring(1,template.length() - 1).contains("}")) {
       output = resolver.getLocalizedMessageTemplate(template);
    }

    output = resolver.getMessage(output, context.getConstraintDescriptor().getAttributes());     
   
    return output;
  }
View Full Code Here


    return this.interpolate(messageTemplate, context, (GwtLocale)null) ;
  }

  public String interpolate(String messageTemplate, Context context, GwtLocale locale) {
   
    MessageResolver resolver = MessageResolver.INSTANCE;
   
    String template = messageTemplate;
    String output = template;
   
    //only need to get the localized version if and when the string starts and ends with { and } with no { or } in between.
    //"{java...thing.Class.message}" is localized
    //"{attribute} of {property} with {property}" is not localized
    if(template.startsWith("{") && template.endsWith("}") && !template.substring(1,template.length() - 1).contains("{") && !template.substring(1,template.length() - 1).contains("}")) {
       output = resolver.getLocalizedMessageTemplate(template);
    }

    output = resolver.getMessage(output, context.getConstraintDescriptor().getAttributes());     
   
    return output;
  }
View Full Code Here

TOP

Related Classes of com.em.validation.client.messages.MessageResolver

Copyright © 2018 www.massapicom. 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.