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 name must be a valid name according 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).
- 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.void
Parses the external string representation.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
Sets a parameter.- Parameters:
name
- the name of the parametervalue
- the value, null to remove- Returns:
- the old value if replaced, null if new
-
getParameter
Gets the value of a parameter.- Parameters:
name
- the parameter name- Returns:
- the value, null if no such parameter
-
getParameterNames
Gets the parameter names.- Returns:
- the parameter names
-
toString
-
toProperties
Converts a parameter string to a property list.- Returns:
- the property list
-
parse
Parses the external string representation.- Parameters:
parameterString
- the parameter string- Throws:
ParseException
- if parsing the string failed
-