Package com.tangosol.io.pof.reflect
Class Codecs.AbstractCodec
- java.lang.Object
-
- com.tangosol.io.pof.reflect.Codecs.AbstractCodec
-
- All Implemented Interfaces:
Codec
- Direct Known Subclasses:
Codecs.ArrayCodec
,Codecs.CollectionCodec
,Codecs.DefaultCodec
,Codecs.LongArrayCodec
,Codecs.MapCodec
- Enclosing class:
- Codecs
public abstract static class Codecs.AbstractCodec extends Object implements Codec
AbstractCodec
implementations that encodes objects by simply delegating toPofWriter.writeObject(int, Object)
. Generally the default writeObject implementation does not need to be modified as the current accommodation of types and conversion to POF is generally accepted, with the deserialization being more likely to be specific.- Since:
- 3.7.1
-
-
Constructor Summary
Constructors Constructor Description AbstractCodec()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
encode(PofWriter out, int index, Object value)
Serialize an object using the providedPofWriter
.protected static <T> T
newInstance(Class<T> clz)
Return a new instance of T based on the provided Class<T>, or throw a RuntimeException.
-
-
-
Method Detail
-
encode
public void encode(PofWriter out, int index, Object value) throws IOException
Serialize an object using the providedPofWriter
.- Specified by:
encode
in interfaceCodec
- Parameters:
out
- the PofWriter to read fromindex
- the index of the POF property to serializevalue
- the value to serialize- Throws:
IOException
- if an I/O error occurs
-
newInstance
protected static <T> T newInstance(Class<T> clz)
Return a new instance of T based on the provided Class<T>, or throw a RuntimeException.- Type Parameters:
T
- the type to instantiate and return- Parameters:
clz
- the class to instantiate- Returns:
- a new instance of type T
-
-