Class MessageFactory

java.lang.Object
org.apache.tomcat.jdbc.pool.util.MessageFactory

public final class MessageFactory extends Object
Factory for creating localized JDBC pool messages.

The messages are read from the LocalStrings resource bundle of this package, which the JVM resolves once, under the default locale in effect at class initialization. A message is handed out unchanged by get(String) and passed through MessageFormat by get(String, Object...), so bundle text must match how its key is fetched: a key fetched without arguments is written literally, while a key fetched with arguments follows the MessageFormat conventions, where a literal single quote is written ''.

  • Constructor Details

    • MessageFactory

      public MessageFactory(ResourceBundle bundle)
      Constructor.
      Parameters:
      bundle - the resource bundle
  • Method Details

    • get

      public static String get(String key)
      Get a localized message. The message is returned exactly as written in the bundle, with no argument substitution and no MessageFormat applied.
      Parameters:
      key - the message key
      Returns:
      the message
    • get

      public static String get(String key, Object... args)
      Get a localized message with arguments substituted by MessageFormat. The argument array is never modified. A pattern that MessageFormat cannot apply is returned unformatted rather than reported as a failure.
      Parameters:
      key - the message key
      args - the arguments
      Returns:
      the message
    • getInternal

      protected String getInternal(String key)
      Get a message from the bundle.
      Parameters:
      key - the message key
      Returns:
      the message
    • getInternal

      protected String getInternal(String key, Object... args)
      Get a message from the bundle with arguments.
      Parameters:
      key - the message key
      args - the arguments
      Returns:
      the message