Package org.infinispan.protostream.impl
Class BaseMarshallerDelegate<T>
java.lang.Object
org.infinispan.protostream.impl.BaseMarshallerDelegate<T>
- Direct Known Subclasses:
EnumMarshallerDelegate
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
- Author:
- [email protected]
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionabstract BaseMarshaller<T>
Gets the wrapped marshaller.abstract void
marshall
(ProtobufTagMarshaller.WriteContext ctx, FieldDescriptor fieldDescriptor, T value) Marshalls an object.abstract T
unmarshall
(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
- theFieldDescriptor
of the field being marshalled ornull
if 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
- theFieldDescriptor
of the field being unmarshalled ornull
if this is a top-level object- Throws:
IOException
- if unmarshalling fails for some reason
-