public class PropertyRetriever extends Object
Properties as boolean,
int, long, float, double,
String, URL, URI or
enum values.| Constructor and Description |
|---|
PropertyRetriever(Properties props)
Creates a new retriever for the specified properties.
|
PropertyRetriever(Properties props,
boolean enableSysPropOverride)
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.
|
URI |
getOptURI(String key,
URI def)
Retrieves an optional URI value.
|
URL |
getOptURL(String key,
URL def)
Retrieves an optional URL value.
|
String |
getString(String key)
Retrieves a string value.
|
URI |
getURI(String key)
Retrieves a URI value.
|
URL |
getURL(String key)
Retrieves a URL value.
|
boolean |
systemPropertyOverrideIsEnabled()
Gets the system property override setting.
|
public PropertyRetriever(Properties props)
props - The properties. Must not be null.public PropertyRetriever(Properties props, boolean enableSysPropOverride)
props - The properties. Must not be
null.enableSysPropOverride - If true if system properties
with the same names are present they
will override the specified properties,
false to disable this
behaviour.public boolean systemPropertyOverrideIsEnabled()
true if system property override has been enabled,
false if it's disabled.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 URI getURI(String key) throws PropertyParseException
key - The property name.PropertyParseException - On a missing or invalid property.public URI getOptURI(String key, URI 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 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 © 2017 The Transaction Company. All rights reserved.