Package org.infinispan.protostream.impl
Class BaseMarshallerDelegate<T>
- java.lang.Object
-
- org.infinispan.protostream.impl.BaseMarshallerDelegate<T>
-
- Direct Known Subclasses:
EnumMarshallerDelegate
public abstract class BaseMarshallerDelegate<T> extends Object
The marshallers (descendants ofBaseMarshaller) do not have a uniform interface, so an extra layer of indirection is used to provide uniformity. A delegate object wraps the real marshaller and delegates actual marshalling to it, taking into account the specific interface differences for each kind of marshaller (EnumMarshaller, MessageMarshaller, ProtoStreamMarshaller).- Since:
- 1.0
- Author:
- anistor@redhat.com
-
-
Constructor Summary
Constructors Constructor Description BaseMarshallerDelegate()
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description abstract BaseMarshaller<T>getMarshaller()Gets the wrapped marshaller.abstract voidmarshall(ProtobufTagMarshaller.WriteContext ctx, FieldDescriptor fieldDescriptor, T value)Marshalls an object.abstract Tunmarshall(ProtobufTagMarshaller.ReadContext ctx, FieldDescriptor fieldDescriptor)Unmarshalls an object.
-
-
-
Method Detail
-
getMarshaller
public abstract BaseMarshaller<T> getMarshaller()
Gets the wrapped marshaller.- Returns:
- the wrapped marshaller instance
-
marshall
public abstract void marshall(ProtobufTagMarshaller.WriteContext ctx, FieldDescriptor fieldDescriptor, T value) throws IOException
Marshalls an object.- Parameters:
ctx- operation contextfieldDescriptor- theFieldDescriptorof the field being marshalled ornullif this is a top-level objectvalue- the value being marshalled (cannot benull)- Throws:
IOException- if marshalling fails for some reason
-
unmarshall
public abstract T unmarshall(ProtobufTagMarshaller.ReadContext ctx, FieldDescriptor fieldDescriptor) throws IOException
Unmarshalls an object.- Parameters:
ctx- operation contextfieldDescriptor- theFieldDescriptorof the field being unmarshalled ornullif this is a top-level object- Throws:
IOException- if unmarshalling fails for some reason
-
-