|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.thetransactioncompany.util.PropertyRetriever
public class PropertyRetriever
Provides typed retrieval of Properties as boolean,
int, long, float, double,
String, URL or enum values.
| Constructor Summary | |
|---|---|
PropertyRetriever(Properties props)
Creates a new retriever for the specified properties. |
|
| Method Summary | ||
|---|---|---|
boolean |
getBoolean(String key)
Retrieves a boolean value. |
|
double |
getDouble(String key)
Retrieves a double value. |
|
|
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. |
|
|
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. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public PropertyRetriever(Properties props)
props - The properties hasthtable.| Method Detail |
|---|
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.
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.
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.
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.
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.
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.
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.
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.
PropertyParseException - On an invalid property.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||