Package net.sourceforge.jtds.jdbc
Class Messages
- java.lang.Object
-
- net.sourceforge.jtds.jdbc.Messages
-
public final class Messages extends java.lang.Object
Support class forMessages.properties
.- Version:
- $Id: Messages.java,v 1.8 2005/04/20 16:49:22 alin_sinpalean Exp $
- Author:
- David D. Kilzer, Mike Hutchinson
-
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.String
DEFAULT_RESOURCE
Default name for resource bundle containing the messages.private static java.util.ResourceBundle
defaultResource
Cached resource bundle containing the messages.
-
Constructor Summary
Constructors Modifier Constructor Description private
Messages()
Default constructor.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.String
get(java.lang.String key)
Get runtime message using supplied key.static java.lang.String
get(java.lang.String key, java.lang.Object param1)
Get runtime message using supplied key and substitute parameter into message.private static java.lang.String
get(java.lang.String key, java.lang.Object[] arguments)
Get runtime error using supplied key and substitute parameters into message.(package private) static java.lang.String
get(java.lang.String key, java.lang.Object param1, java.lang.Object param2)
Get runtime message using supplied key and substitute parameters into message.(package private) static void
loadDriverProperties(java.util.Map propertyMap, java.util.Map descriptionMap)
Retrieve the list of driver property names and driver property descriptions fromMessages.properties
and populate them intoMap
objects.private static java.util.ResourceBundle
loadResourceBundle()
Load theDEFAULT_RESOURCE
resource bundle.
-
-
-
Field Detail
-
DEFAULT_RESOURCE
private static final java.lang.String DEFAULT_RESOURCE
Default name for resource bundle containing the messages.- See Also:
- Constant Field Values
-
defaultResource
private static java.util.ResourceBundle defaultResource
Cached resource bundle containing the messages.ResourceBundle
does caching internally but this caching involves a lot of string operations to generate the keys used for caching, leading to a lot ofStringBuffer
reallocation. In one run through the complete jTDS test suite there were over 60000 allocations and reallocations (about one for eachget()
call).
-
-
Method Detail
-
get
public static java.lang.String get(java.lang.String key)
Get runtime message using supplied key.- Parameters:
key
- The key of the message in Messages.properties- Returns:
- The selected message as a
String
.
-
get
public static java.lang.String get(java.lang.String key, java.lang.Object param1)
Get runtime message using supplied key and substitute parameter into message.- Parameters:
key
- The key of the message in Messages.propertiesparam1
- The object to insert into message.- Returns:
- The selected message as a
String
.
-
get
static java.lang.String get(java.lang.String key, java.lang.Object param1, java.lang.Object param2)
Get runtime message using supplied key and substitute parameters into message.- Parameters:
key
- The key of the message in Messages.propertiesparam1
- The object to insert into message.param2
- The object to insert into message.- Returns:
- The selected message as a
String
.
-
get
private static java.lang.String get(java.lang.String key, java.lang.Object[] arguments)
Get runtime error using supplied key and substitute parameters into message.- Parameters:
key
- The key of the error message in Messages.propertiesarguments
- The objects to insert into the message.- Returns:
- The selected error message as a
String
.
-
loadDriverProperties
static void loadDriverProperties(java.util.Map propertyMap, java.util.Map descriptionMap)
Retrieve the list of driver property names and driver property descriptions fromMessages.properties
and populate them intoMap
objects. The keys used to populate bothpropertyMap
anddescriptionMap
are guaranteed to match up as long as the properties defined inMessages.properties
are well-formed.- Parameters:
propertyMap
- The map of property names to be populated.descriptionMap
- The map of property descriptions to be populated.
-
loadResourceBundle
private static java.util.ResourceBundle loadResourceBundle()
Load theDEFAULT_RESOURCE
resource bundle.- Returns:
- The resource bundle.
-
-