org.xins.server
Class FunctionResult

java.lang.Object
  extended byorg.xins.server.FunctionResult
Direct Known Subclasses:
InvalidRequestResult, InvalidResponseResult

public class FunctionResult
extends Object

Result from a function call.

Since:
XINS 1.0.0
Version:
$Revision: 1.33 $ $Date: 2006/09/02 12:34:35 $
Author:
Anthony Goubard

Constructor Summary
FunctionResult()
          Creates a new successful FunctionResult instance.
FunctionResult(String code)
          Creates a new FunctionResult instance.
FunctionResult(String code, BasicPropertyReader parameters)
          Creates a new FunctionResult instance.
 
Method Summary
protected  void add(Element element)
          Adds a new org.xins.common.xml.Element to the data element.
protected  void add(Element element)
          Deprecated. Deprecated since XINS 1.3.0. Use add(org.xins.common.xml.Element) instead.
protected  InvalidResponseResult checkOutputParameters()
          Checks that the output parameters are set as specified.
 Element getDataElement()
          Gets the data element from this result.
 String getErrorCode()
          Returns the result code.
 String getParameter(String name)
          Gets the value of the specified parameter.
 PropertyReader getParameters()
          Gets all parameters.
protected  void param(String name, String value)
          Adds an output parameter to the result.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FunctionResult

public FunctionResult()
Creates a new successful FunctionResult instance.


FunctionResult

public FunctionResult(String code)
Creates a new FunctionResult instance.

Parameters:
code - the error code, can be null if the result is successful.

FunctionResult

public FunctionResult(String code,
                      BasicPropertyReader parameters)
Creates a new FunctionResult instance.

Parameters:
code - the error code, can be null if the result is successful.
parameters - the parameters for the result.
Method Detail

getErrorCode

public String getErrorCode()
Returns the result code.

Returns:
the result code or null if no code was returned.

checkOutputParameters

protected InvalidResponseResult checkOutputParameters()
Checks that the output parameters are set as specified. If a parameter is missing or if the value for it is invalid, then an InvalidResponseResult is returned. Otherwise the parameters are considered valid, and null is returned.

The implementation of this method in class FunctionResult always returns null.

Returns:
an InvalidResponseResult instance if at least one output parameter is missing or invalid, or null otherwise.

param

protected void param(String name,
                     String value)
Adds an output parameter to the result. The name and the value must both be specified.

Parameters:
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.

getParameters

public PropertyReader getParameters()
Gets all parameters.

Returns:
a PropertyReader containing all parameters, or null if no parameters are set; the keys will be the names of the parameters (String objects, cannot be null), the values will be the parameter values (String objects as well, cannot be null).

getParameter

public String getParameter(String name)
Gets the value of the specified parameter.

Parameters:
name - the parameter element name, not null.
Returns:
string containing the value of the parameter element, or null if the value is not set.

add

protected void add(Element element)
Adds a new org.xins.common.xml.Element to the data element.

Parameters:
element - the new element to add to the result, cannot be null.
Since:
XINS 1.1.0

add

protected void add(Element element)
Deprecated. Deprecated since XINS 1.3.0. Use add(org.xins.common.xml.Element) instead.

Adds a new org.xins.server.Element to the data element.

Parameters:
element - the new element to add to the result, cannot be null.

getDataElement

public Element getDataElement()
Gets the data element from this result.

Returns:
the data element of the result, can be null.

toString

public String toString()


See http://www.xins.org/.