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 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 Details

    • BaseMarshallerDelegate

      public BaseMarshallerDelegate()
  • Method Details

    • 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 context
      fieldDescriptor - the FieldDescriptor of the field being marshalled or null if this is a top-level object
      value - the value being marshalled (cannot be null)
      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 context
      fieldDescriptor - the FieldDescriptor of the field being unmarshalled or null if this is a top-level object
      Throws:
      IOException - if unmarshalling fails for some reason