Class Marshalling


  • public final class Marshalling
    extends java.lang.Object
    Contains static methods for marshalling values.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static java.util.Map<java.lang.Class<?>,​java.lang.Byte> CLASS_TO_ARGUMENTTYPE  
      private static org.slf4j.Logger LOGGER  
      private static java.util.Map<java.lang.reflect.Type,​java.lang.String[]> TYPE_CACHE  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private Marshalling()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.Object[] convertParameters​(java.lang.Object[] _parameters, java.lang.reflect.Type[] _types, AbstractConnection _conn)
      Recursively converts types for serialization onto DBus.
      (package private) static java.lang.Object deSerializeParameter​(java.lang.Object _parameter, java.lang.reflect.Type _type, AbstractConnection _conn)  
      static java.lang.Object[] deSerializeParameters​(java.lang.Object[] _parameters, java.lang.reflect.Type[] _types, AbstractConnection _conn)  
      (package private) static java.util.List<java.lang.Object> deSerializeParameters​(java.util.List<java.lang.Object> _parameters, java.lang.reflect.Type _type, AbstractConnection _conn)  
      static java.lang.String[] getDBusType​(java.lang.reflect.Type _javaType)
      Will return the DBus type corresponding to the given Java type.
      static java.lang.String getDBusType​(java.lang.reflect.Type[] _javaType)
      Will return the DBus type corresponding to the given Java type.
      static java.lang.String[] getDBusType​(java.lang.reflect.Type _dataType, boolean _basic)
      Will return the DBus type corresponding to the given Java type.
      static int getJavaType​(java.lang.String _dbusType, java.util.List<java.lang.reflect.Type> _resultValue, int _limit)
      Converts a dbus type string into Java Type objects,
      private static java.lang.String[] recursiveGetDBusType​(java.lang.StringBuffer[] _out, java.lang.reflect.Type _dataType, boolean _basic, int _level)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • LOGGER

        private static final org.slf4j.Logger LOGGER
      • TYPE_CACHE

        private static final java.util.Map<java.lang.reflect.Type,​java.lang.String[]> TYPE_CACHE
      • CLASS_TO_ARGUMENTTYPE

        private static final java.util.Map<java.lang.Class<?>,​java.lang.Byte> CLASS_TO_ARGUMENTTYPE
    • Constructor Detail

      • Marshalling

        private Marshalling()
    • Method Detail

      • getDBusType

        public static java.lang.String getDBusType​(java.lang.reflect.Type[] _javaType)
                                            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:
        _javaType - 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 _javaType)
                                              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:
        _javaType - 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 _dataType,
                                                     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:
        _dataType - 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

        private static java.lang.String[] recursiveGetDBusType​(java.lang.StringBuffer[] _out,
                                                               java.lang.reflect.Type _dataType,
                                                               boolean _basic,
                                                               int _level)
                                                        throws DBusException
        Throws:
        DBusException
      • getJavaType

        public static int getJavaType​(java.lang.String _dbusType,
                                      java.util.List<java.lang.reflect.Type> _resultValue,
                                      int _limit)
                               throws DBusException
        Converts a dbus type string into Java Type objects,
        Parameters:
        _dbusType - The DBus type or types.
        _resultValue - List 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 - on error
      • 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.
        _conn - the connection
        Returns:
        The converted parameters.
        Throws:
        DBusException - Thrown if there is an error in converting the objects.
      • deSerializeParameter

        static java.lang.Object deSerializeParameter​(java.lang.Object _parameter,
                                                     java.lang.reflect.Type _type,
                                                     AbstractConnection _conn)
                                              throws java.lang.Exception
        Throws:
        java.lang.Exception
      • deSerializeParameters

        static java.util.List<java.lang.Object> deSerializeParameters​(java.util.List<java.lang.Object> _parameters,
                                                                      java.lang.reflect.Type _type,
                                                                      AbstractConnection _conn)
                                                               throws java.lang.Exception
        Throws:
        java.lang.Exception
      • deSerializeParameters

        public static java.lang.Object[] deSerializeParameters​(java.lang.Object[] _parameters,
                                                               java.lang.reflect.Type[] _types,
                                                               AbstractConnection _conn)
                                                        throws java.lang.Exception
        Throws:
        java.lang.Exception