1/*- 2 * See the file LICENSE for redistribution information. 3 * 4 * Copyright (c) 2002,2008 Oracle. All rights reserved. 5 * 6 * $Id: MarshalledEnt.java,v 12.7 2008/01/08 20:58:30 bostic Exp $ 7 */ 8 9package collections.ship.marshal; 10 11import com.sleepycat.bind.tuple.TupleInput; 12import com.sleepycat.bind.tuple.TupleOutput; 13 14/** 15 * MarshalledEnt is implemented by entity (combined key/data) objects and 16 * called by {@link SampleViews.MarshalledEntityBinding}. In this sample, 17 * MarshalledEnt is implemented by {@link Part}, {@link Supplier}, and 18 * {@link Shipment}. This interface is package-protected rather than public 19 * to hide the marshalling interface from other users of the data objects. 20 * Note that a MarshalledEnt must also have a no arguments constructor so 21 * that it can be instantiated by the binding. 22 * 23 * @author Mark Hayes 24 */ 25interface MarshalledEnt { 26 27 /** 28 * Extracts the entity's primary key and writes it to the key output. 29 */ 30 void marshalPrimaryKey(TupleOutput keyOutput); 31 32 /** 33 * Completes construction of the entity by setting its primary key from the 34 * stored primary key. 35 */ 36 void unmarshalPrimaryKey(TupleInput keyInput); 37 38 /** 39 * Extracts the entity's index key and writes it to the key output. 40 */ 41 boolean marshalSecondaryKey(String keyName, TupleOutput keyOutput); 42} 43