com.dyuproject.protostuff.runtime
Class MappedSchema<T>
java.lang.Object
com.dyuproject.protostuff.runtime.MappedSchema<T>
- All Implemented Interfaces:
- Schema<T>
- Direct Known Subclasses:
- RuntimeSchema
public abstract class MappedSchema<T>
- extends java.lang.Object
- implements Schema<T>
Base class for schemas that maps fields by number and name.
For fast initialization, the last field number is provided in the constructor.
- Author:
- David Yu
- Date created:
- Nov 10, 2009
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
typeClass
protected final java.lang.Class<T> typeClass
fields
protected final MappedSchema.Field<T>[] fields
fieldsByNumber
protected final MappedSchema.Field<T>[] fieldsByNumber
fieldsByName
protected final java.util.Map<java.lang.String,MappedSchema.Field<T>> fieldsByName
pipeSchema
protected final Pipe.Schema<T> pipeSchema
MappedSchema
public MappedSchema(java.lang.Class<T> typeClass,
MappedSchema.Field<T>[] fields,
int lastFieldNumber)
MappedSchema
public MappedSchema(java.lang.Class<T> typeClass,
java.util.Collection<MappedSchema.Field<T>> fields,
int lastFieldNumber)
MappedSchema
public MappedSchema(java.lang.Class<T> typeClass,
java.util.Map<java.lang.String,MappedSchema.Field<T>> fieldsByName,
int lastFieldNumber)
getFieldCount
public int getFieldCount()
- Returns the message's total number of fields.
typeClass
public java.lang.Class<T> typeClass()
- Specified by:
typeClass in interface Schema<T>
messageName
public java.lang.String messageName()
- Specified by:
messageName in interface Schema<T>
messageFullName
public java.lang.String messageFullName()
- Specified by:
messageFullName in interface Schema<T>
getFieldName
public java.lang.String getFieldName(int number)
- Specified by:
getFieldName in interface Schema<T>
getFieldNumber
public int getFieldNumber(java.lang.String name)
- Specified by:
getFieldNumber in interface Schema<T>
mergeFrom
public final void mergeFrom(Input input,
T message)
throws java.io.IOException
- Specified by:
mergeFrom in interface Schema<T>
- Throws:
java.io.IOException
writeTo
public final void writeTo(Output output,
T message)
throws java.io.IOException
- Specified by:
writeTo in interface Schema<T>
- Throws:
java.io.IOException
getPipeSchema
public Pipe.Schema<T> getPipeSchema()
- Returns the pipe schema linked to this.
Copyright © 2009-2014. All Rights Reserved.