Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 //Copyright 2007-2011 David Yu
 //Licensed under the Apache License, Version 2.0 (the "License");
 //you may not use this file except in compliance with the License.
 //You may obtain a copy of the License at 
 //Unless required by applicable law or agreed to in writing, software
 //distributed under the License is distributed on an "AS IS" BASIS,
//See the License for the specific language governing permissions and
//limitations under the License.
package io.protostuff.runtime;
A runtime field w/c represents an abstract class, interface or a base type with many possible subclasses.

The type metadata is written for the deserializer to know the actual/exact schema to use upon deserialization.

Limitations: The number of fields are limited to 126 (127 is the usual limit anyway). The order of the fields being written must be preserved. It will not work if the message serialized is coming from the browser since the fields will most likey be out-of-order (unless you have control of the json serialization).

David Yu
Jan 16, 2011
abstract class RuntimeDerivativeField<T> extends Field<T>

The schema of the polymorphic pojo.
    public final DerivativeSchema schema;

The class of the message field.
    public final Class<ObjecttypeClass;
    public RuntimeDerivativeField(Class<ObjecttypeClassFieldType type,
            int numberString nameboolean repeatedTag tag,
            IdStrategy strategy)
        this. = typeClass;
         = new DerivativeSchema(strategy)
            protected void doMergeFrom(Input input,
                    Schema<ObjectderivedSchemaObject owner)
                    throws IOException
    protected abstract void doMergeFrom(Input input,
            Schema<ObjectderivedSchemaObject ownerthrows IOException;
New to GrepCode? Check out our FAQ X