com.funambol.client.ipc.rpc
Class RPCParam

java.lang.Object
  extended by com.funambol.client.ipc.rpc.RPCParam

public class RPCParam
extends java.lang.Object

This class represents a parameter (both input and output) in remote procedure calls. This implementation supports the types specified by Xml Rpc. A parameter can be a scalar type (int, string and so on) or a complex one, like an array or a struct. The definition of RPCParam is recursive to accomodate the recursive nature of types. Arrays and structs have elements which are RPCParam, allowing for arbitrary complex data to be represented.


Field Summary
static int TYPE_ARRAY
           
static int TYPE_BASE64
           
static int TYPE_BOOLEAN
           
static int TYPE_DATETIME
           
static int TYPE_DOUBLE
           
static int TYPE_INT
           
static int TYPE_STRING
           
static int TYPE_STRUCT
           
 
Constructor Summary
RPCParam()
          Construct an empty parameter, with type STRING
 
Method Summary
 RPCParam[] getArrayValue()
          Get the parameter value as an array.
 java.lang.String getBase64Value()
          Get the parameter value as a string representing base64 data.
 boolean getBooleanValue()
          Get the parameter value as a boolean.
 java.lang.String getDateTimeValue()
          Get the parameter value as a string representing date time.
 double getDoubleValue()
          Get the parameter value as a double.
 int getIntValue()
          Get the parameter value as a integer.
 java.lang.String getName()
          Get the parameter name.
 java.lang.String getStringValue()
          Get the parameter value as a string.
 RPCParam[] getStructValue()
          Get the parameter value as a struct.
 int getType()
          Get the parameter type.
 void setArrayValue(RPCParam[] value)
          Set the array value of this parameter.
 void setBase64Value(java.lang.String value)
          Set the base 64 (string) value of this parameter.
 void setBooleanValue(boolean value)
          Set the boolean value of this parameter.
 void setDateTimeValue(java.lang.String value)
          Set the date time (string) value of this parameter.
 void setDoubleValue(double value)
          Set the double value of this parameter.
 void setIntValue(int value)
          Set the integer value of this parameter.
 void setName(java.lang.String name)
          Set the parameter name.
 void setStringValue(java.lang.String value)
          Set the string value of this parameter.
 void setStructValue(RPCParam[] value)
          Set the struct value of this parameter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TYPE_INT

public static final int TYPE_INT
See Also:
Constant Field Values

TYPE_STRING

public static final int TYPE_STRING
See Also:
Constant Field Values

TYPE_BOOLEAN

public static final int TYPE_BOOLEAN
See Also:
Constant Field Values

TYPE_BASE64

public static final int TYPE_BASE64
See Also:
Constant Field Values

TYPE_DOUBLE

public static final int TYPE_DOUBLE
See Also:
Constant Field Values

TYPE_DATETIME

public static final int TYPE_DATETIME
See Also:
Constant Field Values

TYPE_ARRAY

public static final int TYPE_ARRAY
See Also:
Constant Field Values

TYPE_STRUCT

public static final int TYPE_STRUCT
See Also:
Constant Field Values
Constructor Detail

RPCParam

public RPCParam()
Construct an empty parameter, with type STRING

Method Detail

getType

public int getType()
Get the parameter type.


getStringValue

public java.lang.String getStringValue()
Get the parameter value as a string. This method may return null if the parameter has a non STRING type.

Returns:
the string value

getIntValue

public int getIntValue()
Get the parameter value as a integer. This method may return a meaningless value if the parameter has a non INT type.

Returns:
the string value

getDoubleValue

public double getDoubleValue()
Get the parameter value as a double. This method may return a meaningless value if the parameter has a non DOUBLE type.

Returns:
the string value

getDateTimeValue

public java.lang.String getDateTimeValue()
Get the parameter value as a string representing date time. This method may return null if the parameter has a non DATETIME type.

Returns:
the string value

getBase64Value

public java.lang.String getBase64Value()
Get the parameter value as a string representing base64 data. This method may return null if the parameter has a non BASE64 type.

Returns:
the string value

getBooleanValue

public boolean getBooleanValue()
Get the parameter value as a boolean. This method may return a meaningless value if the parameter has a non BOOLEAN type.

Returns:
the boolean value

getArrayValue

public RPCParam[] getArrayValue()
Get the parameter value as an array. This method may return null if the parameter has a non ARRAY type. Each value of the array is represented as an RPCParam, with its type and its value

Returns:
the array value

getStructValue

public RPCParam[] getStructValue()
Get the parameter value as a struct. This method may return null if the parameter has a non STRUCT type. Each member of the struct is represented as an RPCParam, with its type, value and name.

Returns:
the struct value

getName

public java.lang.String getName()
Get the parameter name. This value is only used/meaningful for struct where fields are named.


setIntValue

public void setIntValue(int value)
Set the integer value of this parameter. The type is set to INT automatically.

Parameters:
value - the value

setDoubleValue

public void setDoubleValue(double value)
Set the double value of this parameter. The type is set to DOUBLE automatically.

Parameters:
value - the value

setStringValue

public void setStringValue(java.lang.String value)
Set the string value of this parameter. The type is set to STRING automatically.

Parameters:
value - the value

setBase64Value

public void setBase64Value(java.lang.String value)
Set the base 64 (string) value of this parameter. The type is set to BASE64 automatically.

Parameters:
value - the value

setDateTimeValue

public void setDateTimeValue(java.lang.String value)
Set the date time (string) value of this parameter. The type is set to DATETIME automatically.

Parameters:
value - the value

setBooleanValue

public void setBooleanValue(boolean value)
Set the boolean value of this parameter. The type is set to BOOLEAN automatically.

Parameters:
value - the value

setArrayValue

public void setArrayValue(RPCParam[] value)
Set the array value of this parameter. The type is set to ARRAY automatically.

Parameters:
value - the value

setStructValue

public void setStructValue(RPCParam[] value)
Set the struct value of this parameter. The type is set to STRUCT automatically.

Parameters:
value - the value

setName

public void setName(java.lang.String name)
Set the parameter name. This value is only used/meaningful for struct where fields are named.



Copyright © 2001-2009 Funambol.