Package org.apache.tomcat.jdbc.pool.util
Class MessageFactory
- java.lang.Object
-
- org.apache.tomcat.jdbc.pool.util.MessageFactory
-
public final class MessageFactory extends java.lang.ObjectFactory for creating localized JDBC pool messages.The messages are read from the
LocalStringsresource bundle of this package, which the JVM resolves once, under the default locale in effect at class initialization. A message is handed out unchanged byget(String)and passed throughMessageFormatbyget(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 Summary
Constructors Constructor Description MessageFactory(java.util.ResourceBundle bundle)Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static java.lang.Stringget(java.lang.String key)Get a localized message.static java.lang.Stringget(java.lang.String key, java.lang.Object... args)Get a localized message with arguments substituted by MessageFormat.protected java.lang.StringgetInternal(java.lang.String key)Get a message from the bundle.protected java.lang.StringgetInternal(java.lang.String key, java.lang.Object... args)Get a message from the bundle with arguments.
-
-
-
Method Detail
-
get
public static java.lang.String get(java.lang.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 java.lang.String get(java.lang.String key, java.lang.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 keyargs- the arguments- Returns:
- the message
-
getInternal
protected java.lang.String getInternal(java.lang.String key)
Get a message from the bundle.- Parameters:
key- the message key- Returns:
- the message
-
getInternal
protected java.lang.String getInternal(java.lang.String key, java.lang.Object... args)Get a message from the bundle with arguments.- Parameters:
key- the message keyargs- the arguments- Returns:
- the message
-
-