1 8 9 package collections.ship.marshal; 10 11 import java.io.Serializable ; 12 13 import com.sleepycat.bind.tuple.TupleInput; 14 import com.sleepycat.bind.tuple.TupleOutput; 15 16 33 public class Part implements Serializable , MarshalledEntity { 34 35 private transient String number; 36 private String name; 37 private String color; 38 private Weight weight; 39 private String city; 40 41 public Part(String number, String name, String color, Weight weight, 42 String city) { 43 44 this.number = number; 45 this.name = name; 46 this.color = color; 47 this.weight = weight; 48 this.city = city; 49 } 50 51 55 final void setKey(String number) { 56 57 this.number = number; 58 } 59 60 public final String getNumber() { 61 62 return number; 63 } 64 65 public final String getName() { 66 67 return name; 68 } 69 70 public final String getColor() { 71 72 return color; 73 } 74 75 public final Weight getWeight() { 76 77 return weight; 78 } 79 80 public final String getCity() { 81 82 return city; 83 } 84 85 public String toString() { 86 87 return "[Part: number=" + number + 88 " name=" + name + 89 " color=" + color + 90 " weight=" + weight + 91 " city=" + city + ']'; 92 } 93 94 96 Part() { 97 98 } 101 102 public void unmarshalPrimaryKey(TupleInput keyInput) { 103 104 this.number = keyInput.readString(); 105 } 106 107 public void marshalPrimaryKey(TupleOutput keyOutput) { 108 109 keyOutput.writeString(this.number); 110 } 111 112 public boolean marshalSecondaryKey(String keyName, TupleOutput keyOutput) { 113 114 throw new UnsupportedOperationException (keyName); 115 } 116 } 117 | Popular Tags |