|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.sun.sgs.impl.sharedutil.PropertiesWrapper
public class PropertiesWrapper
Wrapper around a Properties that provides convenience methods for
accessing primitives.
| Constructor Summary | |
|---|---|
PropertiesWrapper(Properties properties)
Creates an instance that delegates to the given Properties. |
|
| Method Summary | ||
|---|---|---|
boolean |
getBooleanProperty(String name,
boolean defaultValue)
Returns the value of a boolean property. |
|
|
getClassInstanceProperty(String name,
Class<T> type,
Class<?>[] paramTypes,
Object... args)
Returns an instance of the class whose fully qualified class name is specified by a property, and that has a constructor with the specified parameters. |
|
|
getClassInstanceProperty(String name,
String defaultClass,
Class<T> type,
Class<?>[] paramTypes,
Object... args)
Returns an instance of the class whose fully qualified class name is specified by a property, and that has a constructor with the specified parameters. |
|
|
getEnumProperty(String name,
Class<T> enumType,
T defaultValue)
Returns the value of an Enum property. |
|
int |
getIntProperty(String name,
int defaultValue)
Returns the value of an int property. |
|
int |
getIntProperty(String name,
int defaultValue,
int min,
int max)
Returns the value of an int property within a bound range of
values. |
|
long |
getLongProperty(String name,
long defaultValue)
Returns the value of a long property. |
|
long |
getLongProperty(String name,
long defaultValue,
long min,
long max)
Returns the value of a long property within a bound range of
values. |
|
Properties |
getProperties()
Returns the associated Properties. |
|
String |
getProperty(String name)
Returns the value of a property as a String, or
null if the property is not found. |
|
String |
getProperty(String name,
String defaultValue)
Returns the value of a property as a String, or the default
value if the property is not found. |
|
int |
getRequiredIntProperty(String name)
Returns the value of a required int property. |
|
int |
getRequiredIntProperty(String name,
int min,
int max)
Returns the value of a required int property within a bound
range of values. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public PropertiesWrapper(Properties properties)
Properties.
properties - the Properties to wrap| Method Detail |
|---|
public Properties getProperties()
Properties.
Propertiespublic String getProperty(String name)
String, or
null if the property is not found.
name - the property name
null
public String getProperty(String name,
String defaultValue)
String, or the default
value if the property is not found.
name - the property namedefaultValue - the default value
public boolean getBooleanProperty(String name,
boolean defaultValue)
boolean property.
name - the property namedefaultValue - the default value
public int getIntProperty(String name,
int defaultValue)
int property.
name - the property namedefaultValue - the default value
NumberFormatException - if the value does not contain a parsable
intpublic int getRequiredIntProperty(String name)
int property.
name - the property name
IllegalArgumentException - if the value is not set
NumberFormatException - if the value does not contain a parsable
int
public int getIntProperty(String name,
int defaultValue,
int min,
int max)
int property within a bound range of
values.
name - the property namedefaultValue - the default valuemin - the minimum value to allowmax - the maximum value to allow
IllegalArgumentException - if the value or defaultValue
is less than min or greater than max, or if
min is greater than max
NumberFormatException - if the value does not contain a parsable
int
public int getRequiredIntProperty(String name,
int min,
int max)
int property within a bound
range of values.
name - the property namemin - the minimum value to allowmax - the maximum value to allow
IllegalArgumentException - if the value or defaultValue
is less than min or greater than max, or if
min is greater than max, or if the value
is not set
NumberFormatException - if the value does not contain a parsable
int
public long getLongProperty(String name,
long defaultValue)
long property.
name - the property namedefaultValue - the default value
NumberFormatException - if the value does not contain a parsable
long
public long getLongProperty(String name,
long defaultValue,
long min,
long max)
long property within a bound range of
values.
name - the property namedefaultValue - the default valuemin - the minimum value to allowmax - the maximum value to allow
IllegalArgumentException - if the value or defaultValue
is less than min or greater than max, or if
min is greater than max
NumberFormatException - if the value does not contain a parsable
long
public <T> T getClassInstanceProperty(String name,
Class<T> type,
Class<?>[] paramTypes,
Object... args)
T - the type of the return valuename - the property nametype - the class which the return value should be an instance ofparamTypes - the constructor parameter typesargs - the arguments to pass to the constructor
null if the property is not
found
IllegalArgumentException - if the property is found and a problem
occurs creating the instance, or if the constructor throws
a checked exception
public <T> T getClassInstanceProperty(String name,
String defaultClass,
Class<T> type,
Class<?>[] paramTypes,
Object... args)
T - the type of the return valuename - the property namedefaultClass - the fully qualified class name to use if the
name property is not foundtype - the class which the return value should be an instance ofparamTypes - the constructor parameter typesargs - the arguments to pass to the constructor
null if the property is not
found and defaultClassName is null
IllegalArgumentException - if a problem occurs creating the
instance, or if the constructor throws a checked exception
public <T extends Enum<T>> T getEnumProperty(String name,
Class<T> enumType,
T defaultValue)
Enum property.
T - the enumeration typename - the property nameenumType - the enumeration typedefaultValue - the default value
IllegalArgumentException - if the value does not name a constant
of the enumeration type
|
Project Darkstar, Version 0.9.10.9 2013-07-29 21:26:22 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||