com.dyuproject.protostuff
Class Pipe.Schema<T>

java.lang.Object
  extended by com.dyuproject.protostuff.Pipe.Schema<T>
All Implemented Interfaces:
Schema<Pipe>
Enclosing class:
Pipe

public abstract static class Pipe.Schema<T>
extends java.lang.Object
implements Schema<Pipe>

Schema for transferring data from a source (Input) to a different sink (Output).


Field Summary
 Schema<T> wrappedSchema
           
 
Constructor Summary
Pipe.Schema(Schema<T> wrappedSchema)
           
 
Method Summary
 java.lang.String getFieldName(int number)
          Gets the field name associated with the number.
 int getFieldNumber(java.lang.String name)
          Gets the field number associated with the name.
 boolean isInitialized(Pipe message)
          Always returns true since we're just transferring data.
 void mergeFrom(Input input, Pipe pipe)
          Deserializes a message/object from the input.
 java.lang.String messageFullName()
          Returns the full name of the message tied to this schema.
 java.lang.String messageName()
          Returns the simple name of the message tied to this schema.
 Pipe newMessage()
          Creates the message/object tied to this schema.
protected abstract  void transfer(Pipe pipe, Input input, Output output)
          Transfer data from the Input to the Output.
 java.lang.Class<Pipe> typeClass()
          Gets the class of the message.
 void writeTo(Output output, Pipe pipe)
          Serializes a message/object to the output.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

wrappedSchema

public final Schema<T> wrappedSchema
Constructor Detail

Pipe.Schema

public Pipe.Schema(Schema<T> wrappedSchema)
Method Detail

getFieldName

public java.lang.String getFieldName(int number)
Description copied from interface: Schema
Gets the field name associated with the number. This is particularly useful when serializing to different formats (Eg. JSON). When using numeric field names:
 return String.valueOf(number);
 

Specified by:
getFieldName in interface Schema<Pipe>

getFieldNumber

public int getFieldNumber(java.lang.String name)
Description copied from interface: Schema
Gets the field number associated with the name. This is particularly useful when serializing to different formats (Eg. JSON). When using numeric field names:
 return Integer.parseInt(name);
 

Specified by:
getFieldNumber in interface Schema<Pipe>

isInitialized

public boolean isInitialized(Pipe message)
Always returns true since we're just transferring data.

Specified by:
isInitialized in interface Schema<Pipe>

messageFullName

public java.lang.String messageFullName()
Description copied from interface: Schema
Returns the full name of the message tied to this schema. Allows custom schemas to provide a custom name other than typeClass().getName();

Specified by:
messageFullName in interface Schema<Pipe>

messageName

public java.lang.String messageName()
Description copied from interface: Schema
Returns the simple name of the message tied to this schema. Allows custom schemas to provide a custom name other than typeClass().getSimpleName();

Specified by:
messageName in interface Schema<Pipe>

newMessage

public Pipe newMessage()
Description copied from interface: Schema
Creates the message/object tied to this schema.

Specified by:
newMessage in interface Schema<Pipe>

typeClass

public java.lang.Class<Pipe> typeClass()
Description copied from interface: Schema
Gets the class of the message.

Specified by:
typeClass in interface Schema<Pipe>

writeTo

public final void writeTo(Output output,
                          Pipe pipe)
                   throws java.io.IOException
Description copied from interface: Schema
Serializes a message/object to the output.

Specified by:
writeTo in interface Schema<Pipe>
Throws:
java.io.IOException

mergeFrom

public final void mergeFrom(Input input,
                            Pipe pipe)
                     throws java.io.IOException
Description copied from interface: Schema
Deserializes a message/object from the input.

Specified by:
mergeFrom in interface Schema<Pipe>
Throws:
java.io.IOException

transfer

protected abstract void transfer(Pipe pipe,
                                 Input input,
                                 Output output)
                          throws java.io.IOException
Transfer data from the Input to the Output.

Throws:
java.io.IOException


Copyright © 2009-2014. All Rights Reserved.