Package org.infinispan.protostream.impl
Class BaseMarshallerDelegate<T>
java.lang.Object
org.infinispan.protostream.impl.BaseMarshallerDelegate<T>
- Direct Known Subclasses:
EnumMarshallerDelegate,MessageMarshallerDelegate,ProtobufTagMarshallerDelegate
The marshallers (descendants of
BaseMarshaller) 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
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract BaseMarshaller<T> 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.
-
Constructor Details
-
BaseMarshallerDelegate
public BaseMarshallerDelegate()
-
-
Method Details
-
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
-