Class CheckingSerializerDecorator<T>
- java.lang.Object
 - 
- com.exonum.binding.common.serialization.CheckingSerializerDecorator<T>
 
 
- 
- Type Parameters:
 T- a type of serializable object
- All Implemented Interfaces:
 Serializer<T>
public final class CheckingSerializerDecorator<T> extends Object implements Serializer<T>
A serializer decorator, that performs some extra checks to ensure that a user-supplied serializer adheres toSerializercontract. These are required in Java code that interacts with native code and accepts user-implemented serializers. 
- 
- 
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <T> CheckingSerializerDecorator<T>from(Serializer<T> serializer)Creates a checking serializer decorator.TfromBytes(byte[] serializedValue)De-serializes a value from a given byte array.byte[]toBytes(T value)Serializes a given value into a byte array. 
 - 
 
- 
- 
Method Detail
- 
from
public static <T> CheckingSerializerDecorator<T> from(Serializer<T> serializer)
Creates a checking serializer decorator. Will not decorate itself.- Parameters:
 serializer- a serializer to decorate
 
- 
toBytes
public byte[] toBytes(T value)
Description copied from interface:SerializerSerializes a given value into a byte array.- Specified by:
 toBytesin interfaceSerializer<T>- Parameters:
 value- a value to serialize, must not be null- Returns:
 - a byte array containing a serialized value
 
 
- 
fromBytes
public T fromBytes(byte[] serializedValue)
Description copied from interface:SerializerDe-serializes a value from a given byte array.- Specified by:
 fromBytesin interfaceSerializer<T>- Parameters:
 serializedValue- an array containing a serialized value of type T, must not be null- Returns:
 - a value
 
 
 - 
 
 -