org.freedesktop.dbus
Class Marshalling

java.lang.Object
  extended by org.freedesktop.dbus.Marshalling

public class Marshalling
extends java.lang.Object

Contains static methods for marshalling values.


Constructor Summary
Marshalling()
           
 
Method Summary
static java.lang.Object[] convertParameters(java.lang.Object[] parameters, java.lang.reflect.Type[] types, AbstractConnection conn)
          Recursively converts types for serialization onto DBus.
static java.lang.String[] getDBusType(java.lang.reflect.Type c)
          Will return the DBus type corresponding to the given Java type.
static java.lang.String getDBusType(java.lang.reflect.Type[] c)
          Will return the DBus type corresponding to the given Java type.
static java.lang.String[] getDBusType(java.lang.reflect.Type c, boolean basic)
          Will return the DBus type corresponding to the given Java type.
static int getJavaType(java.lang.String dbus, java.util.List<java.lang.reflect.Type> rv, int limit)
          Converts a dbus type string into Java Type objects,
static java.lang.String[] recursiveGetDBusType(java.lang.reflect.Type c, boolean basic, int level)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Marshalling

public Marshalling()
Method Detail

getDBusType

public static java.lang.String getDBusType(java.lang.reflect.Type[] c)
                                    throws DBusException
Will return the DBus type corresponding to the given Java type. Note, container type should have their ParameterizedType not their Class passed in here.

Parameters:
c - The Java types.
Returns:
The DBus types.
Throws:
DBusException - If the given type cannot be converted to a DBus type.

getDBusType

public static java.lang.String[] getDBusType(java.lang.reflect.Type c)
                                      throws DBusException
Will return the DBus type corresponding to the given Java type. Note, container type should have their ParameterizedType not their Class passed in here.

Parameters:
c - The Java type.
Returns:
The DBus type.
Throws:
DBusException - If the given type cannot be converted to a DBus type.

getDBusType

public static java.lang.String[] getDBusType(java.lang.reflect.Type c,
                                             boolean basic)
                                      throws DBusException
Will return the DBus type corresponding to the given Java type. Note, container type should have their ParameterizedType not their Class passed in here.

Parameters:
c - The Java type.
basic - If true enforces this to be a non-compound type. (compound types are Maps, Structs and Lists/arrays).
Returns:
The DBus type.
Throws:
DBusException - If the given type cannot be converted to a DBus type.

recursiveGetDBusType

public static java.lang.String[] recursiveGetDBusType(java.lang.reflect.Type c,
                                                      boolean basic,
                                                      int level)
                                               throws DBusException
Throws:
DBusException

getJavaType

public static int getJavaType(java.lang.String dbus,
                              java.util.List<java.lang.reflect.Type> rv,
                              int limit)
                       throws DBusException
Converts a dbus type string into Java Type objects,

Parameters:
dbus - The DBus type or types.
rv - Vector to return the types in.
limit - Maximum number of types to parse (-1 == nolimit).
Returns:
number of characters parsed from the type string.
Throws:
DBusException

convertParameters

public static java.lang.Object[] convertParameters(java.lang.Object[] parameters,
                                                   java.lang.reflect.Type[] types,
                                                   AbstractConnection conn)
                                            throws DBusException
Recursively converts types for serialization onto DBus.

Parameters:
parameters - The parameters to convert.
types - The (possibly generic) types of the parameters.
Returns:
The converted parameters.
Throws:
DBusException - Thrown if there is an error in converting the objects.