public class DatabasePropertyResourceBundle extends java.lang.Object implements DatabaseResourceBundle
PropertyResourceBundle
in form and function, but is designed to supply SQL language translations
rather than spoken language translations.
DatabasePropertyResourceBundles are typically loaded using a
DatabaseResourceBundleManager.
Like java.util.PropertyResourceBundle, DatabaseResourceBundle
resources are specified in Properties files. Unlike
PropertyResourceBundle, DatabaseResourceBundle uses
the EProperties
enhanced Properties package, which extends the standard
java.util.Properties and syntax to include things like:
variable substitution, nesting, inclusion and lists.
For instance:
table.name = connector_instances
getvalue.query = "SELECT ${column.connector.name} FROM ${table.name} ..."
Variables may be defined in the DatabaseResourceBundle in which they
are used, or any of the ancestor DatabaseResourceBundles (see below).
Variable substitution is done at the time of the call to
getString(String) or getStringArray(String), so the
returned string(s) have all known substitutions resolved.create.table.ddl = ( "CREATE TABLE ...", "CREATE TRIGGER ...", "CREATE INDEX ..." )which can be retrieved using
getStringArray(String):
String[] ddlStatements = bundle.getStringArray("create.table.ddl");
| Constructor and Description |
|---|
DatabasePropertyResourceBundle(java.net.URL resourceUrl,
DatabasePropertyResourceBundle parent)
Creates a
DatabaseResourceBundle backed by the properties
loaded from the resourceUrl and the given parent. |
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
getString(java.lang.String key)
Gets a string for the given key from this resource bundle or one of
its parents.
|
java.lang.String[] |
getStringArray(java.lang.String key)
Gets an array of Strings for the given
key from this resource
bundle or one of its parents. |
public DatabasePropertyResourceBundle(java.net.URL resourceUrl,
DatabasePropertyResourceBundle parent)
throws java.io.IOException
DatabaseResourceBundle backed by the properties
loaded from the resourceUrl and the given parent.resourceUrl - the resource URL from which to read Propertiesparent - parent the DatabasePropertyResourceBundle to assign as parent
- may be nulljava.lang.NullPointerException - if resourceUrl is nulljava.io.IOException - if there is an error reading the resource filepublic java.lang.String getString(java.lang.String key)
getString in interface DatabaseResourceBundlekey - the key for the desired stringnull if no
resource was found for this keyjava.lang.NullPointerException - if key is nullpublic java.lang.String[] getStringArray(java.lang.String key)
key from this resource
bundle or one of its parents.getStringArray in interface DatabaseResourceBundlekey - the key for the desired string arraynull if no
resource was found for this keyjava.lang.NullPointerException - if key is null