Package org.onosproject.store.service
Interface Serializer
-
- All Known Subinterfaces:
StoreSerializer
public interface Serializer
Interface for serialization of store artifacts.
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description <T> T
copy(T object)
Copies the specified object.<T> T
decode(byte[] bytes)
Deserialize the specified bytes.<T> byte[]
encode(T object)
Serialize the specified object.static Serializer
forTypes(java.lang.Class<?>... classes)
static Serializer
using(java.util.List<KryoNamespace> namespaces, java.lang.Class<?>... classes)
Creates a new Serializer instance from a list of KryoNamespaces and some additional classes.static Serializer
using(KryoNamespace kryo)
Creates a new Serializer instance from a KryoNamespace.static Serializer
using(KryoNamespace namespace, java.lang.Class<?>... classes)
Creates a new Serializer instance from a KryoNamespace and some additional classes.
-
-
-
Method Detail
-
encode
<T> byte[] encode(T object)
Serialize the specified object.- Type Parameters:
T
- encoded type- Parameters:
object
- object to serialize.- Returns:
- serialized bytes.
-
decode
<T> T decode(byte[] bytes)
Deserialize the specified bytes.- Type Parameters:
T
- decoded type- Parameters:
bytes
- byte array to deserialize.- Returns:
- deserialized object.
-
copy
<T> T copy(T object)
Copies the specified object.- Type Parameters:
T
- object type- Parameters:
object
- object to copy.- Returns:
- copied object
-
using
static Serializer using(KryoNamespace kryo)
Creates a new Serializer instance from a KryoNamespace.- Parameters:
kryo
- kryo namespace- Returns:
- Serializer instance
-
using
static Serializer using(KryoNamespace namespace, java.lang.Class<?>... classes)
Creates a new Serializer instance from a KryoNamespace and some additional classes.- Parameters:
namespace
- kryo namespaceclasses
- variable length array of classes to register- Returns:
- Serializer instance
-
using
static Serializer using(java.util.List<KryoNamespace> namespaces, java.lang.Class<?>... classes)
Creates a new Serializer instance from a list of KryoNamespaces and some additional classes.- Parameters:
namespaces
- kryo namespacesclasses
- variable length array of classes to register- Returns:
- Serializer instance
-
forTypes
static Serializer forTypes(java.lang.Class<?>... classes)
-
-