01: /*-
02: * See the file LICENSE for redistribution information.
03: *
04: * Copyright (c) 2002,2008 Oracle. All rights reserved.
05: *
06: * $Id: MarshalledEntity.java,v 1.15.2.2 2008/01/07 15:14:02 cwl Exp $
07: */
08:
09: package collections.ship.marshal;
10:
11: import com.sleepycat.bind.tuple.TupleInput;
12: import com.sleepycat.bind.tuple.TupleOutput;
13:
14: /**
15: * MarshalledEntity is implemented by entity (combined key/data) objects and
16: * called by {@link SampleViews.MarshalledEntityBinding}. In this sample,
17: * MarshalledEntity 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 MarshalledEntity must also have a no arguments constructor so
21: * that it can be instantiated by the binding.
22: *
23: * @author Mark Hayes
24: */
25: interface MarshalledEntity {
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: }
|