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 for a java.util.Collection. Null values are not written.

David Yu
Jan 26, 2011
abstract class RuntimeCollectionField<T, V> extends Field<T>

Since we cannot inherit multiple classes, we create this Collection schema simply to delegate to the wrapping class' abstract methods.
    protected final CollectionSchema<V> schema;
    public RuntimeCollectionField(FieldType typeint numberString name,
            Tag tagMessageFactory messageFactory)
         = new CollectionSchema<V>(messageFactory)
            protected void addValueFrom(Input inputCollection<V> collection)
                    throws IOException
            protected void writeValueTo(Output outputint fieldNumber,
                    V valueboolean repeatedthrows IOException
            protected void transferValue(Pipe pipeInput inputOutput output,
                    int numberboolean repeatedthrows IOException
    protected abstract void addValueFrom(Input inputCollection<V> collection)
            throws IOException;
    protected abstract void writeValueTo(Output outputint fieldNumber,
            V valueboolean repeatedthrows IOException;
    protected abstract void transferValue(Pipe pipeInput input,
            Output outputint numberboolean repeatedthrows IOException;
New to GrepCode? Check out our FAQ X