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:
FieldSetMarshaller<EnumSet<E>,EnumSetBuilder<E>>
public class EnumSetFieldSetMarshaller<E extends Enum<E>> extends Object implements FieldSetMarshaller<EnumSet<E>,EnumSetBuilder<E>>
Marshaller for the fields of anEnumSet.- Author:
- Paul Ferraro
-
-
Constructor Summary
Constructors Constructor Description EnumSetFieldSetMarshaller()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description EnumSetBuilder<E>getBuilder()Returns a builder for use withFieldSetMarshaller.readField(ProtoStreamReader, int, Object).intgetFields()Returns the number of fields written by this marshaller.EnumSetBuilder<E>readField(ProtoStreamReader reader, int index, EnumSetBuilder<E> builder)Reads a single field from the specified reader at the specified index.voidwriteFields(ProtoStreamWriter writer, int startIndex, EnumSet<E> set)Writes the set of fields from the specified object to the specified writer beginning at the specified index.
-
-
-
Method Detail
-
getBuilder
public EnumSetBuilder<E> getBuilder()
Description copied from interface:FieldSetMarshallerReturns a builder for use withFieldSetMarshaller.readField(ProtoStreamReader, int, Object). May return a shared instance, if the builder type is immutable, or a new instance, if the builder is mutable.- Specified by:
getBuilderin interfaceFieldSetMarshaller<EnumSet<E extends Enum<E>>,EnumSetBuilder<E extends Enum<E>>>- Returns:
- a builder.
-
getFields
public int getFields()
Description copied from interface:FieldSetMarshallerReturns the number of fields written by this marshaller.- Specified by:
getFieldsin interfaceFieldSetMarshaller<EnumSet<E extends Enum<E>>,EnumSetBuilder<E extends Enum<E>>>- Returns:
- a positive number
-
readField
public EnumSetBuilder<E> readField(ProtoStreamReader reader, int index, EnumSetBuilder<E> builder) throws IOException
Description copied from interface:FieldSetMarshallerReads a single field from the specified reader at the specified index.- Specified by:
readFieldin interfaceFieldSetMarshaller<EnumSet<E extends Enum<E>>,EnumSetBuilder<E extends Enum<E>>>- Parameters:
reader- a ProtoStream readerindex- the field indexbuilder- the builder to be populated with the read field- Returns:
- the builder containing the read field
- Throws:
IOException- if the field could not be read
-
writeFields
public void writeFields(ProtoStreamWriter writer, int startIndex, EnumSet<E> set) throws IOException
Description copied from interface:FieldSetMarshallerWrites the set of fields from the specified object to the specified writer beginning at the specified index.- Specified by:
writeFieldsin interfaceFieldSetMarshaller<EnumSet<E extends Enum<E>>,EnumSetBuilder<E extends Enum<E>>>- Parameters:
writer- a ProtoStream writerstartIndex- the start index for the embedded fieldsset- the value to be written- Throws:
IOException- if the value could not be written
-
-