|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.maryanovsky.gwtutils.client.Properties
public class Properties
Parses and provides access to a set of properties mapped to string keys. This
is quite similar to the Properties
class, but provides a
little more functionality for accessing and parsing the properties.
Constructor Summary | |
---|---|
Properties(Map<String,String> props)
Creates a new Properties object with the specified map of
actual, unparsed properties. |
|
Properties(Map<String,String> props,
Properties delegate)
Creates a new Properties object with the specified map of
actual, unparsed properties, and a backup Properties object which
is consulted if a certain property is not found locally. |
Method Summary | |
---|---|
String |
get(String propertyName)
Returns the value of specified property. |
String |
get(String propertyName,
String defaultValue)
Returns the value of the specified property, or the specified default value if there is no property with the specified name. |
boolean |
getBoolean(String propertyName)
Returns the value of the specified property, parsed as a boolean value. |
boolean |
getBoolean(String propertyName,
boolean defaultValue)
Returns the value of the specified property, parsed as a boolean value, or the specified default value if there is no such property. |
char |
getChar(String propertyName)
Returns the value of the specified property, parsed as a character. |
char |
getChar(String propertyName,
char defaultValue)
Returns the value of the specified property, parsed as a character, or the specfied default value if there is no such property. |
double |
getDouble(String propertyName)
Returns the value of the specified property, parsed as a floating point value. |
double |
getDouble(String propertyName,
double defaultValue)
Returns the value of the specified property, parsed as a floating point value, or the specified default value if there is no property with the specified name. |
int |
getInt(String propertyName)
Returns the value of the specified property, parsed as an integer. |
int |
getInt(String propertyName,
int defaultValue)
Returns the value of the specified property, parsed as an integer, or the specified default value if there is no property with the specified name. |
String[] |
getStringList(String propertyName)
Returns the value of the specified property, parsed a list of comma-separated strings. |
String[] |
getStringList(String propertyName,
String[] defaultValue)
Returns the value of the specified property, parsed as a list of comma-separated strings, or the specified default value if there is no property with the specified name. |
protected RuntimeException |
invalidPropertyException(String propertyName,
String propertyValue)
Returns the exception to throw when encountering an invalid property. |
protected RuntimeException |
missingPropertyException(String propertyName)
Returns the exception to throw when encountering a missing property. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Properties(Map<String,String> props, Properties delegate)
Properties
object with the specified map of
actual, unparsed properties, and a backup Properties
object which
is consulted if a certain property is not found locally.
public Properties(Map<String,String> props)
Properties
object with the specified map of
actual, unparsed properties.
Method Detail |
---|
protected RuntimeException missingPropertyException(String propertyName)
IllegalArgumentException
with a
short message and the name of the property.
protected RuntimeException invalidPropertyException(String propertyName, String propertyValue)
IllegalArgumentException
with a
short message and the name and value of the property.
public String get(String propertyName, String defaultValue)
public String get(String propertyName)
missingPropertyException(String)
if there is no property with the
specified name.
public int getInt(String propertyName)
missingPropertyException(String)
if there is no property with the
specified name, or invalidPropertyException(String, String)
if
the property value can't be parsed as an integer.
public int getInt(String propertyName, int defaultValue)
invalidPropertyException(String, String)
if the property
value can't be parsed as an integer.
public double getDouble(String propertyName)
missingPropertyException(String)
if there is no
property with the specified name, or
invalidPropertyException(String, String)
if the property value
can't be parsed as a floating point value.
public double getDouble(String propertyName, double defaultValue)
invalidPropertyException(String, String)
if the property value can't be parsed as a floating point value.
public boolean getBoolean(String propertyName)
"true"
are considered
as true
values, and all strings equal, ignoring case, to
"false"
are considered as false
.
Throws missingPropertyException(String)
if there is no property
with the specified name, or
invalidPropertyException(String, String)
if the property value
can't be parsed as a boolean.
public boolean getBoolean(String propertyName, boolean defaultValue)
"true"
are considered
as true
values, and all strings equal, ignoring case, to
"false"
are considered as false
.
Throws invalidPropertyException(String, String)
if the property
value can't be parsed as a boolean.
public char getChar(String propertyName)
missingPropertyException(String)
if there is no property
with the specified name, or
invalidPropertyException(String, String)
if the property value
can't be parsed as a character.
public char getChar(String propertyName, char defaultValue)
invalidPropertyException(String, String)
if the property
value can't be parsed as a character.
public String[] getStringList(String propertyName)
missingPropertyException(String)
if there is no property with the specified name.
public String[] getStringList(String propertyName, String[] defaultValue)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |