|
||||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.codehaus.spice.salt.config.DefaultParameters
Parameters implementation backed by a Properties object. The developer should
create the DefaultParameters, associate parameters and then invoke makeReadOnly()
before passing the Parameters to the client component.
Constructor Summary | |
---|---|
DefaultParameters()
Create a parameters object with empty prefix. |
|
DefaultParameters(String prefix)
Create a parameters object with specified prefix. |
Method Summary | |
---|---|
protected void |
checkWriteable()
Check if the resource has been "frozen" and thus is read only. |
Parameters |
getChildParameters(String prefix)
Return a Parameters object that represents a subset of parameters with specified prefix. |
protected Set |
getChildren()
Return the set of child parameter objects. |
String |
getParameter(String name)
Return value of parameter with specified name. |
String |
getParameter(String name,
String defaultValue)
Return value of parameter with specified name. |
boolean |
getParameterAsBoolean(String name)
Return value of parameter with specified name as a boolean. |
boolean |
getParameterAsBoolean(String name,
boolean defaultValue)
Return value of parameter with specified name as a boolean. |
float |
getParameterAsFloat(String name)
Return value of parameter with specified name as a float. |
float |
getParameterAsFloat(String name,
float defaultValue)
Return value of parameter with specified name as a float. |
int |
getParameterAsInteger(String name)
Return value of parameter with specified name as an integer. |
int |
getParameterAsInteger(String name,
int defaultValue)
Return value of parameter with specified name as an integer. |
long |
getParameterAsLong(String name)
Return value of parameter with specified name as a long. |
long |
getParameterAsLong(String name,
long defaultValue)
Return value of parameter with specified name as a long. |
String[] |
getParameterNames()
Return the names of all the parameters. |
protected Properties |
getParameters()
Return the backing properties object associated with parameters. |
protected String |
getPrefix()
Return the prefix associated with Parameters object. |
boolean |
isParameter(String name)
Return true of parameter with specified name exists. |
protected boolean |
isReadOnly()
Return true if resource has been made read-only or frozen. |
void |
makeReadOnly()
Mark the resource and all child parameter objects as read only. |
void |
setParameter(String name,
String value)
Set parameter with specified name to specified value. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public DefaultParameters()
public DefaultParameters(String prefix)
prefix
- the prefixMethod Detail |
public String[] getParameterNames()
getParameterNames
in interface Parameters
public boolean isParameter(String name)
isParameter
in interface Parameters
name
- the name
public String getParameter(String name) throws ParameterException
getParameter
in interface Parameters
name
- the name
ParameterException
- if unable to
locate parameterpublic String getParameter(String name, String defaultValue)
getParameter
in interface Parameters
name
- the namedefaultValue
- the defaultValue if specified parameter does not
exist
public boolean getParameterAsBoolean(String name) throws ParameterException
getParameterAsBoolean
in interface Parameters
name
- the name
ParameterException
- if unable to
locate parameter or parameter can not be converted to correct typepublic boolean getParameterAsBoolean(String name, boolean defaultValue)
getParameterAsBoolean
in interface Parameters
name
- the namedefaultValue
- the defaultValue if specified parameter does not
exist or parameter can not be converted to the correct type
public int getParameterAsInteger(String name) throws ParameterException
getParameterAsInteger
in interface Parameters
name
- the name
ParameterException
- if unable to
locate parameter or parameter can not be converted to correct typepublic int getParameterAsInteger(String name, int defaultValue)
getParameterAsInteger
in interface Parameters
name
- the namedefaultValue
- the defaultValue if specified parameter does not
exist or parameter can not be converted to the correct type
public long getParameterAsLong(String name) throws ParameterException
getParameterAsLong
in interface Parameters
name
- the name
ParameterException
- if unable to
locate parameter or parameter can not be converted to correct typepublic long getParameterAsLong(String name, long defaultValue)
getParameterAsLong
in interface Parameters
name
- the namedefaultValue
- the defaultValue if specified parameter does not
exist or parameter can not be converted to the correct type
public float getParameterAsFloat(String name) throws ParameterException
getParameterAsFloat
in interface Parameters
name
- the name
ParameterException
- if unable to
locate parameter or parameter can not be converted to correct typepublic float getParameterAsFloat(String name, float defaultValue)
getParameterAsFloat
in interface Parameters
name
- the namedefaultValue
- the defaultValue if specified parameter does not
exist or parameter can not be converted to the correct type
public Parameters getChildParameters(String prefix)
getChildParameters
in interface Parameters
prefix
- the prefix
public void makeReadOnly()
public void setParameter(String name, String value)
name
- the parameter namevalue
- the parameter valueprotected final Properties getParameters()
protected final String getPrefix()
protected final Set getChildren()
protected final void checkWriteable()
IllegalStateException
- if resource is read-onlyprotected final boolean isReadOnly()
|
||||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |