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