public abstract class CollectionSchema<V> extends Object implements Schema<Collection<V>>
collections. Null values are not serialized/written.
If your application relies on Object.equals(Object), it will fail when a serialized collection contains null
values (The deserialized collection will not contained the null value). MapSchema on the otherhand can
contain both null keys and null values and still succeeding on Object.equals(Object).
| Modifier and Type | Class and Description |
|---|---|
static class |
CollectionSchema.MessageFactories |
static interface |
CollectionSchema.MessageFactory
Creates new
Collection messages. |
| Modifier and Type | Field and Description |
|---|---|
static String |
FIELD_NAME_VALUE |
CollectionSchema.MessageFactory |
messageFactory
Factory for creating
Collection messages. |
Pipe.Schema<Collection<V>> |
pipeSchema |
| Constructor and Description |
|---|
CollectionSchema() |
CollectionSchema(CollectionSchema.MessageFactory messageFactory) |
| Modifier and Type | Method and Description |
|---|---|
protected abstract void |
addValueFrom(Input input,
Collection<V> collection)
Adds the value from the input into the
Collection. |
String |
getFieldName(int number) |
int |
getFieldNumber(String name) |
boolean |
isInitialized(Collection<V> map) |
void |
mergeFrom(Input input,
Collection<V> message) |
String |
messageFullName() |
String |
messageName() |
Collection<V> |
newMessage() |
protected abstract void |
transferValue(Pipe pipe,
Input input,
Output output,
int number,
boolean repeated)
Transfers the value from the input to the output.
|
Class<? super Collection<V>> |
typeClass() |
void |
writeTo(Output output,
Collection<V> message) |
protected abstract void |
writeValueTo(Output output,
int fieldNumber,
V value,
boolean repeated)
Writes the value to the output.
|
public static final String FIELD_NAME_VALUE
public final CollectionSchema.MessageFactory messageFactory
Collection messages.public final Pipe.Schema<Collection<V>> pipeSchema
public CollectionSchema()
public CollectionSchema(CollectionSchema.MessageFactory messageFactory)
protected abstract void addValueFrom(Input input, Collection<V> collection) throws IOException
Collection.IOExceptionprotected abstract void writeValueTo(Output output, int fieldNumber, V value, boolean repeated) throws IOException
IOExceptionprotected abstract void transferValue(Pipe pipe, Input input, Output output, int number, boolean repeated) throws IOException
IOExceptionpublic final String getFieldName(int number)
getFieldName in interface Schema<Collection<V>>public final int getFieldNumber(String name)
getFieldNumber in interface Schema<Collection<V>>public final boolean isInitialized(Collection<V> map)
isInitialized in interface Schema<Collection<V>>public final String messageFullName()
messageFullName in interface Schema<Collection<V>>public final String messageName()
messageName in interface Schema<Collection<V>>public final Class<? super Collection<V>> typeClass()
typeClass in interface Schema<Collection<V>>public final Collection<V> newMessage()
newMessage in interface Schema<Collection<V>>public void mergeFrom(Input input, Collection<V> message) throws IOException
mergeFrom in interface Schema<Collection<V>>IOExceptionpublic void writeTo(Output output, Collection<V> message) throws IOException
writeTo in interface Schema<Collection<V>>IOExceptionCopyright © 2009–2017. All rights reserved.