Package io.protostuff.runtime
Class PolymorphicSchema
- java.lang.Object
-
- io.protostuff.runtime.PolymorphicSchema
-
- All Implemented Interfaces:
Schema<java.lang.Object>
- Direct Known Subclasses:
ArraySchema
,ArraySchemas.Base
,ClassSchema
,NumberSchema
,ObjectSchema
,PolymorphicCollectionSchema
,PolymorphicEnumSchema
,PolymorphicMapSchema
,PolymorphicPojoCollectionSchema
,PolymorphicPojoMapSchema
,PolymorphicPojoSchema
,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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description 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
Fields Modifier and Type Field Description IdStrategy
strategy
-
Constructor Summary
Constructors Constructor Description PolymorphicSchema(IdStrategy strategy)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract Pipe.Schema<java.lang.Object>
getPipeSchema()
The pipe schema associated with this schema.boolean
isInitialized(java.lang.Object message)
Returns true if there is no required field or if all the required fields are set.java.lang.Object
newMessage()
Creates the message/object tied to this schema.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()
Gets the class of the message.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.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)
Description copied from interface:Schema
Returns true if there is no required field or if all the required fields are set.- Specified by:
isInitialized
in interfaceSchema<java.lang.Object>
-
newMessage
public java.lang.Object newMessage()
Description copied from interface:Schema
Creates the message/object tied to this schema.- Specified by:
newMessage
in interfaceSchema<java.lang.Object>
-
typeClass
public java.lang.Class<? super java.lang.Object> typeClass()
Description copied from interface:Schema
Gets the class of the message.
-
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.
-
-