Package org.infinispan.protostream.impl
Interface BaseMarshallerDelegate<T>
-
- All Known Implementing Classes:
EnumMarshallerDelegate
public interface BaseMarshallerDelegate<T>
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, RawProtobufMarshaller).- Since:
- 1.0
- Author:
- [email protected]
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description BaseMarshaller<T>
getMarshaller()
Gets the wrapped marshaller.void
marshall(FieldDescriptor fieldDescriptor, T value, org.infinispan.protostream.impl.ProtoStreamWriterImpl writer, RawProtoStreamWriter out)
Marshalls an object.T
unmarshall(FieldDescriptor fieldDescriptor, org.infinispan.protostream.impl.ProtoStreamReaderImpl reader, RawProtoStreamReader in)
Unmarshalls an object.
-
-
-
Method Detail
-
getMarshaller
BaseMarshaller<T> getMarshaller()
Gets the wrapped marshaller.- Returns:
- the wrapped marshaller instance
-
marshall
void marshall(FieldDescriptor fieldDescriptor, T value, org.infinispan.protostream.impl.ProtoStreamWriterImpl writer, RawProtoStreamWriter out) throws IOException
Marshalls an object.- Parameters:
fieldDescriptor
- theFieldDescriptor
of the field being marshalled ornull
if this is a top-level objectvalue
- the value being marshalled (cannot benull
)writer
- theProtoStreamWriterImpl
instance to use/re-use, if the specific marshaller type needs one; can benull
in which case the delegate has to create aProtoStreamWriterImpl
instance itself based on theout
parameterout
- the Protobuf tag output stream (cannot benull
)- Throws:
IOException
- if marshalling fails for some reason
-
unmarshall
T unmarshall(FieldDescriptor fieldDescriptor, org.infinispan.protostream.impl.ProtoStreamReaderImpl reader, RawProtoStreamReader in) throws IOException
Unmarshalls an object.- Parameters:
fieldDescriptor
- theFieldDescriptor
of the field being unmarshalled ornull
if this is a top-level objectreader
- theProtoStreamReaderImpl
instance to use/re-use, if the specific marshaller type needs one; can benull
in which case the delegate has to create aProtoStreamReaderImpl
instance itself based on thein
parameterin
- the Protobuf tag input stream (cannot benull
)- Throws:
IOException
- if unmarshalling fails for some reason
-
-