public class FunctionResult extends Object
FunctionRequest
Constructor and Description |
---|
FunctionResult()
Creates a new successful
FunctionResult instance with no
parameters. |
FunctionResult(String code)
Creates a new
FunctionResult instance with no parameters. |
FunctionResult(String code,
Map<String,String> parameters)
Creates a new
FunctionResult instance with a specified set
of parameters. |
Modifier and Type | Method and Description |
---|---|
protected void |
add(Element element)
Deprecated.
Use getDataElementBuilder()
|
InvalidResponseResult |
checkOutputParameters()
Checks that the output parameters are set as specified.
|
Element |
getDataElement()
Gets the data element from this result.
|
protected DataElementBuilder |
getDataElementBuilder()
Adds the
DataElementBuilder to create a new the data element. |
String |
getErrorCode()
Returns the result code.
|
String |
getParameter(String name)
Gets the value of the specified parameter.
|
Map<String,String> |
getParameters()
Gets all parameters.
|
protected void |
param(String name,
String value)
Adds an output parameter to the result.
|
String |
toString() |
public FunctionResult()
FunctionResult
instance with no
parameters.public FunctionResult(String code)
FunctionResult
instance with no parameters.code
- the error code, can be null
if the result is successful.public FunctionResult(String code, Map<String,String> parameters)
FunctionResult
instance with a specified set
of parameters.code
- the error code, can be null
if the result is successful.parameters
- the parameters for the result, can be null
if there are
no parameters.public String getErrorCode()
null
if no code was returned.public InvalidResponseResult checkOutputParameters()
InvalidResponseResult
is returned. Otherwise the parameters
are considered valid, and null
is returned.
The implementation of this method in class FunctionResult
always returns null
.
InvalidResponseResult
instance if at least one output
parameter is missing or invalid, or null
otherwise.protected void param(String name, String value) throws IllegalArgumentException
name
- the name of the output parameter, not null
and not an
empty string.value
- the value of the output parameter, not null
and not an
empty string.IllegalArgumentException
- if name == null || "".equals(name)
|| value == null || "".equals(value)
.public String getParameter(String name) throws IllegalArgumentException
name
- the parameter element name, cannot be null
.null
if the value is not set.IllegalArgumentException
- if name == null
.protected void add(Element element) throws IllegalArgumentException
Element
to the data element.element
- the new element to add to the result, cannot be null
.IllegalArgumentException
- if element == null
.protected DataElementBuilder getDataElementBuilder()
DataElementBuilder
to create a new the data element.DataElementBuilder
to create the data element.public Element getDataElement()
null
.See http://www.xins.org/.