Class EnumSetFieldSetMarshaller<E extends Enum<E>>

java.lang.Object
org.wildfly.clustering.marshalling.protostream.util.EnumSetFieldSetMarshaller<E>
Type Parameters:
E - the enum type for this marshaller
All Implemented Interfaces:
FieldReadable<EnumSetBuilder<E>>, FieldSetMarshaller<EnumSet<E>,EnumSetBuilder<E>>, FieldSetMarshaller.Supplied<EnumSet<E>,EnumSetBuilder<E>>, Writable<EnumSet<E>>

public class EnumSetFieldSetMarshaller<E extends Enum<E>> extends Object implements FieldSetMarshaller.Supplied<EnumSet<E>,EnumSetBuilder<E>>
Marshaller for the fields of an EnumSet.
Author:
Paul Ferraro
  • Constructor Details

    • EnumSetFieldSetMarshaller

      public EnumSetFieldSetMarshaller()
  • Method Details

    • createInitialValue

      public EnumSetBuilder<E> createInitialValue()
      Description copied from interface: FieldSetMarshaller
      Returns a builder for use with
      invalid reference
      #readField(ProtoStreamReader, Object)
      . May return a shared instance, if the builder type is immutable, or a new instance, if the builder is mutable.
      Specified by:
      createInitialValue in interface FieldSetMarshaller<EnumSet<E extends Enum<E>>,EnumSetBuilder<E extends Enum<E>>>
      Returns:
      a builder.
    • getFields

      public int getFields()
      Description copied from interface: FieldReadable
      Returns the number of fields in this field set
      Specified by:
      getFields in interface FieldReadable<E extends Enum<E>>
      Returns:
      a number of fields
    • readFrom

      public EnumSetBuilder<E> readFrom(ProtoStreamReader reader, int index, org.infinispan.protostream.descriptors.WireType type, EnumSetBuilder<E> builder) throws IOException
      Description copied from interface: FieldReadable
      Reads a single field from the specified reader.
      Specified by:
      readFrom in interface FieldReadable<E extends Enum<E>>
      Parameters:
      reader - a reader
      index - the zero-based index, relative to this field set, of the field to be read
      type - the wire type of the field to be read
      builder - the current value
      Returns:
      the read value
      Throws:
      IOException - if a field could not be read
    • writeTo

      public void writeTo(ProtoStreamWriter writer, EnumSet<E> set) throws IOException
      Description copied from interface: Writable
      Writes the specified object to the specified writer.
      Specified by:
      writeTo in interface Writable<E extends Enum<E>>
      Parameters:
      writer - a ProtoStream writer
      set - the object to be written
      Throws:
      IOException - if the object could not be written