com.dyuproject.protostuff
Class MessageMapSchema<K,V>

java.lang.Object
  extended by com.dyuproject.protostuff.MapSchema<K,V>
      extended by com.dyuproject.protostuff.MessageMapSchema<K,V>
All Implemented Interfaces:
Schema<java.util.Map<K,V>>

public final class MessageMapSchema<K,V>
extends MapSchema<K,V>

A schema for a Map with Message or pojo keys. The key and value can be null (depending on the particular map impl).

Author:
David Yu
Date created:
Jun 26, 2010

Nested Class Summary
 
Nested classes/interfaces inherited from class com.dyuproject.protostuff.MapSchema
MapSchema.MapWrapper<K,V>, MapSchema.MessageFactories, MapSchema.MessageFactory
 
Field Summary
 Pipe.Schema<K> kPipeSchema
          The pipe schema of the message key.
 Schema<K> kSchema
          The schema of the message key.
 Pipe.Schema<V> vPipeSchema
          The pipe schema of the message value.
 Schema<V> vSchema
          The schema of the message value.
 
Fields inherited from class com.dyuproject.protostuff.MapSchema
FIELD_NAME_ENTRY, FIELD_NAME_KEY, FIELD_NAME_VALUE, messageFactory, pipeSchema
 
Constructor Summary
MessageMapSchema(Schema<K> kSchema, Schema<V> vSchema)
           
MessageMapSchema(Schema<K> kSchema, Schema<V> vSchema, Pipe.Schema<K> kPipeSchema, Pipe.Schema<V> vPipeSchema)
           
 
Method Summary
protected  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  K readKeyFrom(Input input, MapSchema.MapWrapper<K,V> wrapper)
          Reads the key from the input.
protected  void transferKey(Pipe pipe, Input input, Output output, int number, boolean repeated)
          Transfers the key from the input to the output.
protected  void transferValue(Pipe pipe, Input input, Output output, int number, boolean repeated)
          Transfers the value from the input to the output.
protected  void writeKeyTo(Output output, int fieldNumber, K value, boolean repeated)
          Writes the key to the output.
protected  void writeValueTo(Output output, int fieldNumber, V value, boolean repeated)
          Writes the value to the output.
 
Methods inherited from class com.dyuproject.protostuff.MapSchema
getFieldName, getFieldNumber, isInitialized, mergeFrom, messageFullName, messageName, newMessage, typeClass, writeTo
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

kSchema

public final Schema<K> kSchema
The schema of the message key.


vSchema

public final Schema<V> vSchema
The schema of the message value.


kPipeSchema

public final Pipe.Schema<K> kPipeSchema
The pipe schema of the message key.


vPipeSchema

public final Pipe.Schema<V> vPipeSchema
The pipe schema of the message value.

Constructor Detail

MessageMapSchema

public MessageMapSchema(Schema<K> kSchema,
                        Schema<V> vSchema)

MessageMapSchema

public MessageMapSchema(Schema<K> kSchema,
                        Schema<V> vSchema,
                        Pipe.Schema<K> kPipeSchema,
                        Pipe.Schema<V> vPipeSchema)
Method Detail

readKeyFrom

protected K readKeyFrom(Input input,
                        MapSchema.MapWrapper<K,V> wrapper)
                 throws java.io.IOException
Description copied from class: MapSchema
Reads the key from the input. The extra wrapper arg is internally used as an object placeholder during polymorhic deserialization.

Specified by:
readKeyFrom in class MapSchema<K,V>
Throws:
java.io.IOException

putValueFrom

protected void putValueFrom(Input input,
                            MapSchema.MapWrapper<K,V> wrapper,
                            K key)
                     throws java.io.IOException
Description copied from class: MapSchema
Puts the entry(key and value), obtained from the input, into the MapWrapper.

Specified by:
putValueFrom in class MapSchema<K,V>
Throws:
java.io.IOException

writeKeyTo

protected void writeKeyTo(Output output,
                          int fieldNumber,
                          K value,
                          boolean repeated)
                   throws java.io.IOException
Description copied from class: MapSchema
Writes the key to the output.

Specified by:
writeKeyTo in class MapSchema<K,V>
Throws:
java.io.IOException

writeValueTo

protected void writeValueTo(Output output,
                            int fieldNumber,
                            V value,
                            boolean repeated)
                     throws java.io.IOException
Description copied from class: MapSchema
Writes the value to the output.

Specified by:
writeValueTo in class MapSchema<K,V>
Throws:
java.io.IOException

transferKey

protected void transferKey(Pipe pipe,
                           Input input,
                           Output output,
                           int number,
                           boolean repeated)
                    throws java.io.IOException
Description copied from class: MapSchema
Transfers the key from the input to the output.

Specified by:
transferKey in class MapSchema<K,V>
Throws:
java.io.IOException

transferValue

protected void transferValue(Pipe pipe,
                             Input input,
                             Output output,
                             int number,
                             boolean repeated)
                      throws java.io.IOException
Description copied from class: MapSchema
Transfers the value from the input to the output.

Specified by:
transferValue in class MapSchema<K,V>
Throws:
java.io.IOException


Copyright © 2009-2012. All Rights Reserved.