com.dyuproject.protostuff.runtime
Class RuntimeFieldFactory<V>

java.lang.Object
  extended by com.dyuproject.protostuff.runtime.RuntimeFieldFactory<V>

public abstract class RuntimeFieldFactory<V>
extends java.lang.Object

A factory to create runtime fields based on reflection.

Author:
David Yu
Date created:
Nov 10, 2009

Constructor Summary
RuntimeFieldFactory(int id)
           
 
Method Summary
abstract
<T> MappedSchema.Field<T>
create(int number, java.lang.String name, java.lang.reflect.Field field, IdStrategy strategy)
          Creates a runtime field based on reflection.
static RuntimeFieldFactory<?> getFieldFactory(java.lang.Class<?> clazz)
          Gets the runtime field factory of the given clazz.
static RuntimeFieldFactory<?> getFieldFactory(java.lang.Class<?> clazz, IdStrategy strategy)
          Gets the runtime field factory of the given clazz.
protected abstract  WireFormat.FieldType getFieldType()
           
static
<T> RuntimeFieldFactory<T>
getInline(java.lang.Class<T> typeClass)
          Returns the factory for inline (scalar) values.
protected abstract  V readFrom(Input input)
           
protected abstract  void transfer(Pipe pipe, Input input, Output output, int number, boolean repeated)
           
protected abstract  java.lang.Class<?> typeClass()
           
protected abstract  void writeTo(Output output, int number, V value, boolean repeated)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RuntimeFieldFactory

public RuntimeFieldFactory(int id)
Method Detail

getFieldFactory

public static RuntimeFieldFactory<?> getFieldFactory(java.lang.Class<?> clazz)
Gets the runtime field factory of the given clazz. Method overload for backwards compatibility.


getFieldFactory

public static RuntimeFieldFactory<?> getFieldFactory(java.lang.Class<?> clazz,
                                                     IdStrategy strategy)
Gets the runtime field factory of the given clazz.


getInline

public static <T> RuntimeFieldFactory<T> getInline(java.lang.Class<T> typeClass)
Returns the factory for inline (scalar) values.


create

public abstract <T> MappedSchema.Field<T> create(int number,
                                                 java.lang.String name,
                                                 java.lang.reflect.Field field,
                                                 IdStrategy strategy)
Creates a runtime field based on reflection.


getFieldType

protected abstract WireFormat.FieldType getFieldType()

readFrom

protected abstract V readFrom(Input input)
                       throws java.io.IOException
Throws:
java.io.IOException

writeTo

protected abstract void writeTo(Output output,
                                int number,
                                V value,
                                boolean repeated)
                         throws java.io.IOException
Throws:
java.io.IOException

transfer

protected abstract void transfer(Pipe pipe,
                                 Input input,
                                 Output output,
                                 int number,
                                 boolean repeated)
                          throws java.io.IOException
Throws:
java.io.IOException

typeClass

protected abstract java.lang.Class<?> typeClass()


Copyright © 2009-2012. All Rights Reserved.