blob: fc815357a840f06d58af542ad03040ec09ae7caa (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
/*-
* See the file LICENSE for redistribution information.
*
* Copyright (c) 2002-2009 Oracle. All rights reserved.
*
* $Id$
*/
package collections.ship.marshal;
import com.sleepycat.bind.tuple.TupleInput;
import com.sleepycat.bind.tuple.TupleOutput;
/**
* A PartKey serves as the key in the key/data pair for a part entity.
*
* <p> In this sample, PartKey is bound to the stored key tuple entry by
* implementing the MarshalledKey interface, which is called by {@link
* SampleViews.MarshalledKeyBinding}. </p>
*
* @author Mark Hayes
*/
public class PartKey implements MarshalledKey {
private String number;
public PartKey(String number) {
this.number = number;
}
public final String getNumber() {
return number;
}
public String toString() {
return "[PartKey: number=" + number + ']';
}
// --- MarshalledKey implementation ---
PartKey() {
// A no-argument constructor is necessary only to allow the binding to
// instantiate objects of this class.
}
public void unmarshalKey(TupleInput keyInput) {
this.number = keyInput.readString();
}
public void marshalKey(TupleOutput keyOutput) {
keyOutput.writeString(this.number);
}
}
|