public class StringParameters extends BaseParameters
ParametersString.
Subclasses that wish to expose individual parameters via dedicated
getters and setters should rely on the internal param buffer as much
as possible. Any default values should be set in the implementation
of reset().
| Modifier and Type | Field and Description |
|---|---|
protected ParametersString |
buffer
Buffer where the parameters are stored during conversion.
|
path| Constructor and Description |
|---|
StringParameters()
Creates a new StringParameters object with a null path and an empty buffer.
|
StringParameters(String data)
Creates a new StringParameters object with a null path the specified
initial parameter data
|
| Modifier and Type | Method and Description |
|---|---|
void |
fromString(String data)
Reset this parameters object to its default values and then load
additional parameters from the provided data.
|
void |
fromString(String data,
boolean clearParameters)
Load additional parameters from the provided data.
|
boolean |
getBoolean(String name)
Gets the boolean value for the given parameter name.
|
protected String |
getGroup(String name) |
int |
getInteger(String name)
Gets the integer value for a given parameter name.
|
String |
getString(String name)
Gets the string value for a given parameter name.
|
void |
reset()
Reset this parameters object to its default values.
|
void |
setBoolean(String name,
boolean value)
Sets the boolean value for a given parameter name.
|
protected void |
setGroup(String name,
String value) |
void |
setInteger(String name,
int value)
Sets the integer value for a given parameter name.
|
void |
setString(String name,
String value)
Sets the string value for a given parameter name.
|
String |
toString()
Serialize this parameters object to a string.
|
getParametersDescription, getPath, load, load, save, setPathprotected ParametersString buffer
public StringParameters()
public StringParameters(String data)
data - the string holding the parameters. See IParameters.fromString(java.lang.String).public void reset()
Subclasses should override this method to set any initial
values and instantiate any objects that require allocation. It
is recommended that subclasses also call super.reset()
in the override to ensure that the buffer is empty.
public void fromString(String data)
Subclasses should not normally need to override this method unless
they are maintaining complex values (eg, InlineCodeFinder)
that require extra initialization as part of their parameter state.
data - the string holding the parameters. It must be formatted as
the string generated by toString(). Line-breaks must be normalized to '\n'.
It can also be null or empty, in such case the parameters are left with
their current values. Use reset() to reset the parameters to their defaults.public void fromString(String data, boolean clearParameters)
Subclasses should not normally need to override this method unless
they are maintaining complex values (eg, InlineCodeFinder)
that require extra initialization as part of their parameter state.
data - the string holding the parameters. See IParameters.fromString(java.lang.String).clearParameters - if true, the internal parameters will be cleared before
loading the data. If false, any existing parameters will be left intact
unless they are overridden by the data.public String toString()
Subclasses should not normally need to override this method unless
they are maintaining complex values (eg, InlineCodeFinder)
that require extra serialization as part of their parameter state.
toString in interface IParameterstoString in class Objectpublic boolean getBoolean(String name)
IParametersname - the name of the boolean parameter to retrieve.public void setBoolean(String name, boolean value)
IParametersname - the name of the parameter to set.value - the new value to set.public String getString(String name)
IParametersname - the name of the string parameter to retrieve.public void setString(String name, String value)
IParametersname - the name of the parameter to set.value - the new value to set.public int getInteger(String name)
IParametersname - the name of the integer parameter to retrieve.public void setInteger(String name, int value)
IParametersname - the name of the parameter to set.value - the new value to set.Copyright © 2022. All rights reserved.