Codota Logo
MessagesImpl.<init>
Code IndexAdd Codota to your IDE (free)

How to use
play.i18n.MessagesImpl
constructor

Best Java code snippets using play.i18n.MessagesImpl.<init> (Showing top 12 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
ScheduledThreadPoolExecutor s =
  • Codota Iconnew ScheduledThreadPoolExecutor(corePoolSize)
  • Codota IconThreadFactory threadFactory;new ScheduledThreadPoolExecutor(corePoolSize, threadFactory)
  • Codota IconString str;new ScheduledThreadPoolExecutor(1, new ThreadFactoryBuilder().setNameFormat(str).build())
  • Smart code suggestions by Codota
}
origin: com.typesafe.play/play_2.12

/**
 * Get a messages context appropriate for the given request.
 *
 * Will select a language from the request, based on the languages available, and fallback to the default language
 * if none of the candidates are available.
 *
 * @param request the incoming request
 * @return the preferred messages context for the request
 */
public Messages preferred(Http.RequestHeader request) {
  play.api.i18n.Messages msgs = messages.preferred(request);
  return new MessagesImpl(new Lang(msgs.lang()), this);
}
origin: com.typesafe.play/play

/**
 * Get a messages context appropriate for the given request.
 *
 * Will select a language from the request, based on the languages available, and fallback to the default language
 * if none of the candidates are available.
 *
 * @param request the incoming request
 * @return the preferred messages context for the request
 */
public Messages preferred(Http.RequestHeader request) {
  play.api.i18n.Messages msgs = messages.preferred(request);
  return new MessagesImpl(new Lang(msgs.lang()), this);
}
origin: com.typesafe.play/play_2.11

/**
 * Get a messages context appropriate for the given request.
 *
 * Will select a language from the request, based on the languages available, and fallback to the default language
 * if none of the candidates are available.
 *
 * @param request the incoming request
 * @return the preferred messages context for the request
 */
public Messages preferred(Http.RequestHeader request) {
  play.api.i18n.Messages msgs = messages.preferred(request);
  return new MessagesImpl(new Lang(msgs.lang()), this);
}
origin: com.typesafe.play/play_2.12

/**
 * Get a messages context appropriate for the given candidates.
 *
 * Will select a language from the candidates, based on the languages available, and fallback to the default language
 * if none of the candidates are available.
 *
 * @param candidates the candidate languages
 * @return the most appropriate Messages instance given the candidate languages
 */
public Messages preferred(Collection<Lang> candidates) {
  Seq<Lang> cs = Scala.asScala(candidates);
  play.api.i18n.Messages msgs = messages.preferred((Seq)cs);
  return new MessagesImpl(new Lang(msgs.lang()), this);
}
origin: com.typesafe.play/play_2.11

/**
 * Get a messages context appropriate for the given candidates.
 *
 * Will select a language from the candidates, based on the languages available, and fallback to the default language
 * if none of the candidates are available.
 *
 * @param candidates the candidate languages
 * @return the most appropriate Messages instance given the candidate languages
 */
public Messages preferred(Collection<Lang> candidates) {
  Seq<Lang> cs = Scala.asScala(candidates);
  play.api.i18n.Messages msgs = messages.preferred((Seq)cs);
  return new MessagesImpl(new Lang(msgs.lang()), this);
}
origin: com.typesafe.play/play

/**
 * Get a messages context appropriate for the given candidates.
 *
 * Will select a language from the candidates, based on the languages available, and fallback to the default language
 * if none of the candidates are available.
 *
 * @param candidates the candidate languages
 * @return the most appropriate Messages instance given the candidate languages
 */
public Messages preferred(Collection<Lang> candidates) {
  Seq<Lang> cs = Scala.asScala(candidates);
  play.api.i18n.Messages msgs = messages.preferred((Seq)cs);
  return new MessagesImpl(new Lang(msgs.lang()), this);
}
origin: com.typesafe.play/play-java-forms_2.12

private Set<ConstraintViolation<Object>> runValidation(Lang lang, TypedMap attrs, DataBinder dataBinder, Map<String, Object> objectData) {
  return withRequestLocale(lang, () -> {
    dataBinder.bind(new MutablePropertyValues(objectData));
    final ValidationPayload payload = new ValidationPayload(lang, lang != null ? new MessagesImpl(lang, this.messagesApi) : null, Http.Context.safeCurrent().map(ctx -> ctx.args).orElse(null), attrs, this.config);
    final Validator validator = validatorFactory.unwrap(HibernateValidatorFactory.class).usingContext().constraintValidatorPayload(payload).getValidator();
    if (groups != null) {
      return validator.validate(dataBinder.getTarget(), groups);
    } else {
      return validator.validate(dataBinder.getTarget());
    }
  });
}
origin: com.typesafe.play/play-java-forms

private Set<ConstraintViolation<Object>> runValidation(Lang lang, TypedMap attrs, DataBinder dataBinder, Map<String, Object> objectData) {
  return withRequestLocale(lang, () -> {
    dataBinder.bind(new MutablePropertyValues(objectData));
    final ValidationPayload payload = new ValidationPayload(lang, lang != null ? new MessagesImpl(lang, this.messagesApi) : null, Http.Context.safeCurrent().map(ctx -> ctx.args).orElse(null), attrs, this.config);
    final Validator validator = validatorFactory.unwrap(HibernateValidatorFactory.class).usingContext().constraintValidatorPayload(payload).getValidator();
    if (groups != null) {
      return validator.validate(dataBinder.getTarget(), groups);
    } else {
      return validator.validate(dataBinder.getTarget());
    }
  });
}
origin: com.typesafe.play/play-java-forms_2.11

private Set<ConstraintViolation<Object>> runValidation(Lang lang, TypedMap attrs, DataBinder dataBinder, Map<String, Object> objectData) {
  return withRequestLocale(lang, () -> {
    dataBinder.bind(new MutablePropertyValues(objectData));
    final ValidationPayload payload = new ValidationPayload(lang, lang != null ? new MessagesImpl(lang, this.messagesApi) : null, Http.Context.safeCurrent().map(ctx -> ctx.args).orElse(null), attrs, this.config);
    final Validator validator = validatorFactory.unwrap(HibernateValidatorFactory.class).usingContext().constraintValidatorPayload(payload).getValidator();
    if (groups != null) {
      return validator.validate(dataBinder.getTarget(), groups);
    } else {
      return validator.validate(dataBinder.getTarget());
    }
  });
}
origin: com.typesafe.play/play-java-forms_2.12

private List<ValidationError> getFieldErrorsAsValidationErrors(Lang lang, BindingResult result) {
  return result.getFieldErrors().stream().map(error -> {
    String key = error.getObjectName() + "." + error.getField();
    if (key.startsWith("target.") && rootName == null) {
      key = key.substring(7);
    }
    if (error.isBindingFailure()) {
      ImmutableList.Builder<String> builder = ImmutableList.builder();
      final Messages msgs = lang != null ? new MessagesImpl(lang, this.messagesApi) : null;
      for (String code: error.getCodes()) {
        code = REPLACE_TYPEMISMATCH.matcher(code).replaceAll(Matcher.quoteReplacement(INVALID_MSG_KEY));
        if (msgs == null || msgs.isDefinedAt(code)) {
          builder.add(code);
        }
      }
      final ImmutableList<String> messages = builder.build();
      return new ValidationError(key, messages.isEmpty() ? Arrays.asList(INVALID_MSG_KEY) : messages.reverse(),
          convertErrorArguments(error.getArguments()));
    } else {
      return new ValidationError(key, error.getDefaultMessage(),
          convertErrorArguments(error.getArguments()));
    }
  }).collect(Collectors.toList());
}
origin: com.typesafe.play/play-java-forms_2.11

private List<ValidationError> getFieldErrorsAsValidationErrors(Lang lang, BindingResult result) {
  return result.getFieldErrors().stream().map(error -> {
    String key = error.getObjectName() + "." + error.getField();
    if (key.startsWith("target.") && rootName == null) {
      key = key.substring(7);
    }
    if (error.isBindingFailure()) {
      ImmutableList.Builder<String> builder = ImmutableList.builder();
      final Messages msgs = lang != null ? new MessagesImpl(lang, this.messagesApi) : null;
      for (String code: error.getCodes()) {
        code = REPLACE_TYPEMISMATCH.matcher(code).replaceAll(Matcher.quoteReplacement(INVALID_MSG_KEY));
        if (msgs == null || msgs.isDefinedAt(code)) {
          builder.add(code);
        }
      }
      final ImmutableList<String> messages = builder.build();
      return new ValidationError(key, messages.isEmpty() ? Arrays.asList(INVALID_MSG_KEY) : messages.reverse(),
          convertErrorArguments(error.getArguments()));
    } else {
      return new ValidationError(key, error.getDefaultMessage(),
          convertErrorArguments(error.getArguments()));
    }
  }).collect(Collectors.toList());
}
origin: com.typesafe.play/play-java-forms

private List<ValidationError> getFieldErrorsAsValidationErrors(Lang lang, BindingResult result) {
  return result.getFieldErrors().stream().map(error -> {
    String key = error.getObjectName() + "." + error.getField();
    if (key.startsWith("target.") && rootName == null) {
      key = key.substring(7);
    }
    if (error.isBindingFailure()) {
      ImmutableList.Builder<String> builder = ImmutableList.builder();
      final Messages msgs = lang != null ? new MessagesImpl(lang, this.messagesApi) : null;
      for (String code: error.getCodes()) {
        code = REPLACE_TYPEMISMATCH.matcher(code).replaceAll(Matcher.quoteReplacement(INVALID_MSG_KEY));
        if (msgs == null || msgs.isDefinedAt(code)) {
          builder.add(code);
        }
      }
      final ImmutableList<String> messages = builder.build();
      return new ValidationError(key, messages.isEmpty() ? Arrays.asList(INVALID_MSG_KEY) : messages.reverse(),
          convertErrorArguments(error.getArguments()));
    } else {
      return new ValidationError(key, error.getDefaultMessage(),
          convertErrorArguments(error.getArguments()));
    }
  }).collect(Collectors.toList());
}
play.i18nMessagesImpl<init>

Popular methods of MessagesImpl

    Popular in Java

    • Creating JSON documents from java classes using gson
    • requestLocationUpdates (LocationManager)
    • getResourceAsStream (ClassLoader)
    • notifyDataSetChanged (ArrayAdapter)
    • Pointer (com.sun.jna)
      An abstraction for a native pointer data type. A Pointer instance represents, on the Java side, a na
    • SocketTimeoutException (java.net)
      This exception is thrown when a timeout expired on a socket read or accept operation.
    • ResultSet (java.sql)
      An interface for an object which represents a database table entry, returned as the result of the qu
    • DecimalFormat (java.text)
      DecimalFormat is a concrete subclass ofNumberFormat that formats decimal numbers. It has a variety o
    • Manifest (java.util.jar)
      The Manifest class is used to obtain attribute information for a JarFile and its entries.
    • Base64 (org.apache.commons.codec.binary)
      Provides Base64 encoding and decoding as defined by RFC 2045.This class implements section 6.8. Base
    Codota Logo
    • Products

      Search for Java codeSearch for JavaScript codeEnterprise
    • IDE Plugins

      IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
    • Company

      About UsContact UsCareers
    • Resources

      FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
    Get Codota for your IDE now