net.derquinse.common.test
Class GsonSerializabilityTests

java.lang.Object
  extended by net.derquinse.common.test.GsonSerializabilityTests

public final class GsonSerializabilityTests
extends Object

Gson serializability support methods.

Author:
Andres Rodriguez

Method Summary
static
<T> T
check(Gson gson, T obj)
          Checks serializability of one object and equality of the provided instance and the deserialized one.
static
<T> T
check(Gson gson, T obj, Type type)
          Checks serializability of one object and equality of the provided instance and the deserialized one.
static
<T> T
check(Gson gson, T obj, Type type, boolean equality)
          Checks serializability of one object and (if desired) equality of the provided instance and the deserialized one.
static
<T> T
check(T obj)
          Checks serializability of one object and equality of the provided instance and the deserialized one.
static
<T> T
check(T obj, boolean equality)
          Checks serializability of one object and (if desired) equality of the provided instance and the deserialized one.
static
<T> T
check(T obj, Type type)
          Checks serializability of one object and equality of the provided instance and the deserialized one.
static
<T> T
check(T obj, Type type, boolean equality)
          Checks serializability of one object and (if desired) equality of the provided instance and the deserialized one.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

check

public static <T> T check(Gson gson,
                          T obj,
                          Type type,
                          boolean equality)
               throws UnableToSerializeException
Checks serializability of one object and (if desired) equality of the provided instance and the deserialized one.

Parameters:
gson - Gson instance to use.
obj - Object to test.
type - Type to use for deserialization.
equality - Whether to test for equality.
Returns:
The deserialized instance.
Throws:
UnableToSerializeException
See Also:
EqualityTests.two(Object, Object)

check

public static <T> T check(Gson gson,
                          T obj,
                          Type type)
               throws UnableToSerializeException
Checks serializability of one object and equality of the provided instance and the deserialized one.

Parameters:
gson - Gson instance to use.
obj - Object to test.
type - Type to use for deserialization.
Returns:
The deserialized instance.
Throws:
UnableToSerializeException
See Also:
EqualityTests.two(Object, Object)

check

public static <T> T check(Gson gson,
                          T obj)
               throws UnableToSerializeException
Checks serializability of one object and equality of the provided instance and the deserialized one.

Parameters:
gson - Gson instance to use.
obj - Object to test.
Returns:
The deserialized instance.
Throws:
UnableToSerializeException
See Also:
EqualityTests.two(Object, Object)

check

public static <T> T check(T obj,
                          Type type,
                          boolean equality)
               throws UnableToSerializeException
Checks serializability of one object and (if desired) equality of the provided instance and the deserialized one.

Parameters:
obj - Object to test.
type - Type to use for deserialization.
equality - Whether to test for equality.
Returns:
The deserialized instance.
Throws:
UnableToSerializeException
See Also:
EqualityTests.two(Object, Object)

check

public static <T> T check(T obj,
                          Type type)
               throws UnableToSerializeException
Checks serializability of one object and equality of the provided instance and the deserialized one.

Parameters:
obj - Object to test.
type - Type to use for deserialization.
Returns:
The deserialized instance.
Throws:
UnableToSerializeException
See Also:
EqualityTests.two(Object, Object)

check

public static <T> T check(T obj,
                          boolean equality)
               throws UnableToSerializeException
Checks serializability of one object and (if desired) equality of the provided instance and the deserialized one.

Parameters:
obj - Object to test.
equality - Whether to test for equality.
Returns:
The deserialized instance.
Throws:
UnableToSerializeException
See Also:
EqualityTests.two(Object, Object)

check

public static <T> T check(T obj)
               throws UnableToSerializeException
Checks serializability of one object and equality of the provided instance and the deserialized one.

Parameters:
obj - Object to test.
Returns:
The deserialized instance.
Throws:
UnableToSerializeException
See Also:
EqualityTests.two(Object, Object)


Copyright © 2012 Derquinse Projects. All Rights Reserved.