Interface FieldSetMarshaller<T,B>
-
- Type Parameters:
T- the type of this marshallerB- the builder type for reading embedded fields
- All Known Subinterfaces:
ClassLoaderMarshaller
- All Known Implementing Classes:
ComparatorMarshaller,DurationMarshaller,EnumSetFieldSetMarshaller,InetAddressMarshaller,LocalDateMarshaller,LocalTimeMarshaller,ModuleClassLoaderMarshaller,SimpleClassLoaderMarshaller,UUIDMarshaller,YearMarshaller,ZoneOffsetMarshaller
public interface FieldSetMarshaller<T,B>Marshaller for a set of fields, to be shared between multiple marshallers.- Author:
- Paul Ferraro
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description BgetBuilder()Returns a builder for use withreadField(ProtoStreamReader, int, Object).intgetFields()Returns the number of fields written by this marshaller.BreadField(ProtoStreamReader reader, int index, B builder)Reads a single field from the specified reader at the specified index.voidwriteFields(ProtoStreamWriter writer, int startIndex, T value)Writes the set of fields from the specified object to the specified writer beginning at the specified index.
-
-
-
Method Detail
-
getBuilder
B getBuilder()
Returns a builder for use withreadField(ProtoStreamReader, int, Object). May return a shared instance, if the builder type is immutable, or a new instance, if the builder is mutable.- Returns:
- a builder.
-
getFields
int getFields()
Returns the number of fields written by this marshaller.- Returns:
- a positive number
-
readField
B readField(ProtoStreamReader reader, int index, B builder) throws IOException
Reads a single field from the specified reader at the specified index.- 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
void writeFields(ProtoStreamWriter writer, int startIndex, T value) throws IOException
Writes the set of fields from the specified object to the specified writer beginning at the specified index.- Parameters:
writer- a ProtoStream writerstartIndex- the start index for the embedded fieldsvalue- the value to be written- Throws:
IOException- if the value could not be written
-
-