public class PropertiesUtil extends Object
Constructor and Description |
---|
PropertiesUtil() |
Modifier and Type | Method and Description |
---|---|
static boolean |
existsSubProperties(Properties p,
String prefix)
Determines if getSubProperties would return an empty Properties
or not.
|
static Properties |
getCachedPropertiesForResourceName(String name) |
static String |
getPropertyOrThrow(Properties p,
String key) |
static String |
getPropertyOrThrow(String resourceBundleName,
String key) |
static Properties |
getSubProperties(Properties p,
String prefix)
Takes a Properties with keys such as "rules.x" and "y", and a prefix
string such as "rules" and returns a new Properties with keys such
as "x".
|
static Properties |
newPropertiesForClass(Class<?> c) |
static Properties |
newPropertiesForResourceBundle(ResourceBundle b)
Takes a ResourceBundle (describing keys/values) and converts the object
into a Properties object.
|
static Properties |
newPropertiesForResourceName(String resourceBundleName) |
static Properties |
prefixAllProperties(Properties p,
String prefix)
Takes a properties and prefixes all entries with prefix and a dot
|
static Properties[] |
splitToArray(Properties p,
String prefix)
Takes a prefix like "rules" and then finds "rules.0.x" etc, puts them
into lots of Properties objects with keys like "x" and position 0 in
the array.
|
static Hashtable<String,Properties> |
splitToHashtable(Properties p,
String prefix)
Deprecated.
|
static Map<String,Properties> |
splitToMap(Properties p,
String prefix)
Takes a prefix like "rules" and then finds "rules.name.key", puts
them in a Map.
|
static Vector<Properties> |
splitToVector(Properties p,
String prefix)
Deprecated.
use splitToArray instead, this provides type-safety
|
static Properties |
union(Properties p1,
Properties p2)
Creates a new Properties which is the combination of all the keys in
p1 and p2.
|
public static Vector<Properties> splitToVector(Properties p, String prefix)
public static Properties[] splitToArray(Properties p, String prefix)
splitToVector(java.util.Properties, java.lang.String)
public static Hashtable<String,Properties> splitToHashtable(Properties p, String prefix)
splitToMap(Properties,String)
public static Map<String,Properties> splitToMap(Properties p, String prefix)
public static Properties getSubProperties(Properties p, String prefix)
public static boolean existsSubProperties(Properties p, String prefix)
public static Properties prefixAllProperties(Properties p, String prefix)
public static Properties union(Properties p1, Properties p2)
public static Properties newPropertiesForResourceBundle(ResourceBundle b)
public static Properties newPropertiesForResourceName(String resourceBundleName) throws MissingResourceException
resourceBundleName
- name for example "com.ucpag.components.x" where there
is a properties file called "x.properties"
in the appropriate directory, and returns a Properties object for that file.MissingResourceException
- if file cannot be foundpublic static Properties newPropertiesForClass(Class<?> c)
public static Properties getCachedPropertiesForResourceName(String name) throws MissingResourceException
name
- name for example "com.ucpag.components.x" where there
is a properties file called "x.properties"
in the appropriate directory, and returns a Properties object for that file.MissingResourceException
- if file cannot be foundpublic static String getPropertyOrThrow(Properties p, String key)
public static String getPropertyOrThrow(String resourceBundleName, String key)
resourceBundleName
- name for example "com.databasesandlife.x" where there is a properties file called "x.properties"
in the appropriate directory, and returns a Properties object for that file.