com.dyuproject.protostuff.runtime
Class PolymorphicSchema

java.lang.Object
  extended by com.dyuproject.protostuff.runtime.PolymorphicSchema
All Implemented Interfaces:
Schema<java.lang.Object>
Direct Known Subclasses:
ArraySchema, ClassSchema, NumberSchema, ObjectSchema, PolymorphicCollectionSchema, PolymorphicEnumSchema, PolymorphicMapSchema, PolymorphicThrowableSchema

public abstract class PolymorphicSchema
extends java.lang.Object
implements Schema<java.lang.Object>

Used when the type is either polymorphic or too complex. Unlike DerivativeSchema, this is designed to have no concept of merging.

Author:
David Yu
Date created:
Apr 30, 2012

Nested Class Summary
static interface PolymorphicSchema.Factory
          A factory which creates a schema with the handler connected to it.
static interface PolymorphicSchema.Handler
          The handler who's job is to set the value to the owner.
 
Field Summary
 IdStrategy strategy
           
 
Constructor Summary
PolymorphicSchema(IdStrategy strategy)
           
 
Method Summary
abstract  Pipe.Schema<java.lang.Object> getPipeSchema()
          The pipe schema associated with this schema.
 boolean isInitialized(java.lang.Object message)
           
 java.lang.Object newMessage()
           
protected abstract  void setValue(java.lang.Object value, java.lang.Object owner)
          Set the value to the owner.
 java.lang.Class<? super java.lang.Object> typeClass()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.dyuproject.protostuff.Schema
getFieldName, getFieldNumber, mergeFrom, messageFullName, messageName, writeTo
 

Field Detail

strategy

public final IdStrategy strategy
Constructor Detail

PolymorphicSchema

public PolymorphicSchema(IdStrategy strategy)
Method Detail

isInitialized

public boolean isInitialized(java.lang.Object message)
Specified by:
isInitialized in interface Schema<java.lang.Object>

newMessage

public java.lang.Object newMessage()
Specified by:
newMessage in interface Schema<java.lang.Object>

typeClass

public java.lang.Class<? super java.lang.Object> typeClass()
Specified by:
typeClass in interface Schema<java.lang.Object>

getPipeSchema

public abstract Pipe.Schema<java.lang.Object> getPipeSchema()
The pipe schema associated with this schema.


setValue

protected abstract void setValue(java.lang.Object value,
                                 java.lang.Object owner)
Set the value to the owner.



Copyright © 2009-2014. All Rights Reserved.