Class ParameterString
java.lang.Object
org.tentackle.common.ParameterString
- All Implemented Interfaces:
Serializable
A string of parameters.
Holds parameters of the form:
name1='value1', name2='value2', ...Where the names must conform to the Java convention for variables. The values are any kind of strings enclosed in single quotes. If the value contains a single quote, it is encoded as two consecutive single quotes. The parameters are separated by a comma. The empty string is encoded as nameX instead of nameX='' as a convenience to denote just the presence of a name (e.g., for booleans).
The parser is lenient: any characters between a name and its quoted value (such as = or :)
and between the parameters are ignored. A name without a value ends at the next comma or whitespace.
The insertion order of the parameters is preserved.
- Author:
- harald
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionCreates an empty parameter string.ParameterString(String parameterString) Creates a parameter string from its string representation. -
Method Summary
Modifier and TypeMethodDescriptiongetParameter(String name) Gets the value of a parameter.String[]Gets the parameter names.voidParses the external string representation.
Any parameters already held by this object are removed first.setParameter(String name, String value) Sets a parameter.Converts a parameter string to a property list.toString()
-
Constructor Details
-
ParameterString
public ParameterString()Creates an empty parameter string. -
ParameterString
Creates a parameter string from its string representation.- Parameters:
parameterString- the parameter string- Throws:
ParseException- if parsing the string failed
-
-
Method Details
-
setParameter
-
getParameter
-
getParameterNames
-
toString
-
toProperties
Converts a parameter string to a property list.- Returns:
- the property list
-
parse
Parses the external string representation.
Any parameters already held by this object are removed first.- Parameters:
parameterString- the parameter string, null to just clear the parameters- Throws:
ParseException- if parsing the string failed
-