public abstract class MapSchema<K,V> extends Object implements Schema<Map<K,V>>
Map. The key and value can be null (depending on the particular map impl).
The default Map message created will be an instance of HashMap.
| Modifier and Type | Class and Description |
|---|---|
static class |
MapSchema.MapWrapper<K,V>
A
Map.Entry w/c wraps a Map. |
static class |
MapSchema.MessageFactories
A message factory for standard
Map implementations. |
static interface |
MapSchema.MessageFactory
Creates new
Map messages. |
| Modifier and Type | Field and Description |
|---|---|
static String |
FIELD_NAME_ENTRY
The field name of the Map.Entry.
|
static String |
FIELD_NAME_KEY
The field name of the key.
|
static String |
FIELD_NAME_VALUE
The field name of the value;
|
MapSchema.MessageFactory |
messageFactory
Factory for creating
Map messages. |
Pipe.Schema<Map<K,V>> |
pipeSchema
The pipe schema of the
Map. |
| Constructor and Description |
|---|
MapSchema() |
MapSchema(MapSchema.MessageFactory messageFactory) |
| Modifier and Type | Method and Description |
|---|---|
String |
getFieldName(int number) |
int |
getFieldNumber(String name) |
boolean |
isInitialized(Map<K,V> map) |
void |
mergeFrom(Input input,
Map<K,V> map) |
String |
messageFullName() |
String |
messageName() |
Map<K,V> |
newMessage() |
protected abstract void |
putValueFrom(Input input,
MapSchema.MapWrapper<K,V> wrapper,
K key)
Puts the entry(key and value), obtained from the input, into the
MapWrapper. |
protected abstract K |
readKeyFrom(Input input,
MapSchema.MapWrapper<K,V> wrapper)
Reads the key from the input.
|
protected abstract void |
transferKey(Pipe pipe,
Input input,
Output output,
int number,
boolean repeated)
Transfers the key from the input to the output.
|
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 Map<K,V>> |
typeClass() |
protected abstract void |
writeKeyTo(Output output,
int fieldNumber,
K value,
boolean repeated)
Writes the key to the output.
|
void |
writeTo(Output output,
Map<K,V> map) |
protected abstract void |
writeValueTo(Output output,
int fieldNumber,
V value,
boolean repeated)
Writes the value to the output.
|
public static final String FIELD_NAME_ENTRY
public static final String FIELD_NAME_KEY
public static final String FIELD_NAME_VALUE
public final MapSchema.MessageFactory messageFactory
Map messages.public final Pipe.Schema<Map<K,V>> pipeSchema
Map.public MapSchema()
public MapSchema(MapSchema.MessageFactory messageFactory)
protected abstract K readKeyFrom(Input input, MapSchema.MapWrapper<K,V> wrapper) throws IOException
The extra wrapper arg is internally used as an object placeholder during polymorhic deserialization.
IOExceptionprotected abstract void putValueFrom(Input input, MapSchema.MapWrapper<K,V> wrapper, K key) throws IOException
MapWrapper.IOExceptionprotected abstract void writeKeyTo(Output output, int fieldNumber, K value, boolean repeated) throws IOException
IOExceptionprotected abstract void writeValueTo(Output output, int fieldNumber, V value, boolean repeated) throws IOException
IOExceptionprotected abstract void transferKey(Pipe pipe, Input input, Output output, int number, 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<Map<K,V>>public final int getFieldNumber(String name)
getFieldNumber in interface Schema<Map<K,V>>public final boolean isInitialized(Map<K,V> map)
isInitialized in interface Schema<Map<K,V>>public final String messageFullName()
messageFullName in interface Schema<Map<K,V>>public final String messageName()
messageName in interface Schema<Map<K,V>>public final Map<K,V> newMessage()
newMessage in interface Schema<Map<K,V>>public final void mergeFrom(Input input, Map<K,V> map) throws IOException
Copyright © 2009–2017. All rights reserved.