public class PropertyRetriever extends Object
Properties as boolean,
int, long, float, double,
String, URL or enum values.| Constructor and Description |
|---|
PropertyRetriever(Properties props)
Creates a new retriever for the specified properties.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
getBoolean(String key)
Retrieves a boolean value.
|
double |
getDouble(String key)
Retrieves a double value.
|
<T extends Enum<T>> |
getEnum(String key,
Class<T> enumClass)
Retrieves an enumerated constant.
|
String |
getEnumString(String key,
String[] enums)
Retrieves an enumerated string value.
|
float |
getFloat(String key)
Retrieves a float value.
|
int |
getInt(String key)
Retrieves an integer value.
|
long |
getLong(String key)
Retrieves a long value.
|
boolean |
getOptBoolean(String key,
boolean def)
Retrieves an optional boolean value.
|
double |
getOptDouble(String key,
double def)
Retrieves an optional double value.
|
<T extends Enum<T>> |
getOptEnum(String key,
Class<T> enumClass,
T def)
Retrieves an optional enumerated constant.
|
String |
getOptEnumString(String key,
String[] enums,
String def)
Retrieves an enumerated string value.
|
float |
getOptFloat(String key,
float def)
Retrieves an optional float value.
|
int |
getOptInt(String key,
int def)
Retrieves an optional integer value.
|
long |
getOptLong(String key,
long def)
Retrieves an optional long value.
|
String |
getOptString(String key,
String def)
Retrieves an optional string value.
|
URL |
getOptURL(String key,
URL def)
Retrieves an optional URL value.
|
String |
getString(String key)
Retrieves a string value.
|
URL |
getURL(String key)
Retrieves a URL value.
|
public PropertyRetriever(Properties props)
props - The properties hasthtable.public boolean getBoolean(String key) throws PropertyParseException
key - The property name.PropertyParseException - On a missing or invalid property.public boolean getOptBoolean(String key, boolean def) throws PropertyParseException
key - The property name.def - The default value if the property value is undefined or
empty.PropertyParseException - On an invalid property.public int getInt(String key) throws PropertyParseException
key - The property name.PropertyParseException - On a missing or invalid property.public int getOptInt(String key, int def) throws PropertyParseException
key - The property name.def - The default value if the property value is undefined or
empty.PropertyParseException - On an invalid property.public long getLong(String key) throws PropertyParseException
key - The property name.PropertyParseException - On a missing or invalid property.public long getOptLong(String key, long def) throws PropertyParseException
key - The property name.def - The default value if the property value is undefined or
empty.PropertyParseException - On an invalid property.public float getFloat(String key) throws PropertyParseException
key - The property name.PropertyParseException - On a missing or invalid property.public float getOptFloat(String key, float def) throws PropertyParseException
key - The property name.def - The default value if the property value is undefined or
empty.PropertyParseException - On an invalid property.public double getDouble(String key) throws PropertyParseException
key - The property name.PropertyParseException - On a missing or invalid property.public double getOptDouble(String key, double def) throws PropertyParseException
key - The property name.def - The default value if the property value is undefined or
empty.PropertyParseException - On an invalid property.public String getString(String key) throws PropertyParseException
key - The property name.PropertyParseException - On a missing or invalid property.public String getOptString(String key, String def) throws PropertyParseException
key - The property name.def - The default value if the property value is undefined or
empty.PropertyParseException - On an invalid property.public String getEnumString(String key, String[] enums) throws PropertyParseException
key - The property name.enums - A string array defining the acceptable values.PropertyParseException - On a missing or invalid property.public String getOptEnumString(String key, String[] enums, String def) throws PropertyParseException
key - The property name.enums - A string array defining the acceptable values.def - The default value if the property value is undefined or
empty.PropertyParseException - On an invalid property.public <T extends Enum<T>> T getEnum(String key, Class<T> enumClass) throws PropertyParseException
key - The property name.enumClass - The enumeration class specifying the acceptable
values.PropertyParseException - On a missing or invalid property.public <T extends Enum<T>> T getOptEnum(String key, Class<T> enumClass, T def) throws PropertyParseException
key - The property name.enumClass - The enumeration class specifying the acceptable
values.def - The default value if the property value is
undefined or empty.PropertyParseException - On a missing or invalid property.public URL getURL(String key) throws PropertyParseException
key - The property name.PropertyParseException - On a missing or invalid property.public URL getOptURL(String key, URL def) throws PropertyParseException
key - The property name.def - The default value if the property value is undefined or
empty.PropertyParseException - On an invalid property.Copyright © 2013 The Transaction Company. All Rights Reserved.