|
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.erowid.sperowider.configuration.Configuration
Holds configuration information for constructing an object. It enforces default values, overrides, etc. The general rule is this : every field has :
Constructor Summary | |
Configuration()
|
Method Summary | |
protected void |
addSetting(String name,
boolean required)
Adds a setting, with no default. |
protected void |
addSetting(String name,
Object defaultValue)
Adds a setting, with a default. |
void |
generateConfigurationReport(PrintWriter writer)
Generates a list of what the configured settings are. |
Object |
get(String name)
Returns the value for a setting. |
boolean |
getAsBoolean(String name)
Returns the value for a setting. |
Collection |
getAsCollection(String name)
Returns the value for a setting. |
long |
getAsLong(String name)
Returns the value for a setting. |
String |
getAsString(String name)
Returns the value for a setting. |
String |
getMessage(String name)
Returns the default/required message for a setting. |
List |
getMissingSettings()
Returns a List of String names that are required, but are not
filled in (either by defaults or by calling set(String, Object) or
setUnlessSet(String, Object) . |
boolean |
isValid()
Returns true if all required settings have been set by calling set(String, Object) or
setUnlessSet(String, Object) , or have defaults. |
void |
set(String name,
Object value)
Sets the value of the setting. |
protected void |
setDefault(String name,
Object value)
Sets the default value of the setting. |
void |
setIgnoreNull(String name,
Object value)
Sets the value of the setting, unless value is null. |
protected void |
setMessage(String name,
String message)
Sets the required/default message for a setting. |
void |
setUnlessSet(String name,
Object value)
If the setting has not already been set, this will set it. |
void |
setUnlessSetIgnoreNull(String name,
Object value)
Executes setUnlessSet(String, Object) , unless the value is null. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Configuration()
Method Detail |
protected void addSetting(String name, Object defaultValue)
protected void addSetting(String name, boolean required)
protected void setMessage(String name, String message) throws SettingDoesNotExistException
SettingDoesNotExistException
protected void setDefault(String name, Object value) throws SettingDoesNotExistException
SettingDoesNotExistException
public String getMessage(String name) throws SettingDoesNotExistException
SettingDoesNotExistException
public Object get(String name) throws SettingDoesNotExistException
SettingDoesNotExistException
public String getAsString(String name) throws SettingDoesNotExistException
SettingDoesNotExistException
public boolean getAsBoolean(String name) throws SettingDoesNotExistException
SettingDoesNotExistException
public long getAsLong(String name) throws SettingDoesNotExistException
SettingDoesNotExistException
public Collection getAsCollection(String name) throws SettingDoesNotExistException
SettingDoesNotExistException
public void set(String name, Object value) throws SettingDoesNotExistException
SettingDoesNotExistException
public void setIgnoreNull(String name, Object value) throws SettingDoesNotExistException
SettingDoesNotExistException
public void setUnlessSet(String name, Object value) throws SettingDoesNotExistException
SettingDoesNotExistException
public void setUnlessSetIgnoreNull(String name, Object value) throws SettingDoesNotExistException
setUnlessSet(String, Object)
, unless the value is null.
SettingDoesNotExistException
public List getMissingSettings()
List
of String
names that are required, but are not
filled in (either by defaults or by calling set(String, Object)
or
setUnlessSet(String, Object)
. Returns an empty list if there are none missing.
public boolean isValid()
set(String, Object)
or
setUnlessSet(String, Object)
, or have defaults.
public void generateConfigurationReport(PrintWriter writer)
|
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |