Main Page | Class Hierarchy | Data Structures | Directories | File List | Data Fields | Related Pages

Part.java

00001 /*-
00002  * See the file LICENSE for redistribution information.
00003  *
00004  * Copyright (c) 2002-2005
00005  *      Sleepycat Software.  All rights reserved.
00006  *
00007  * $Id: Part.java,v 12.2 2005/06/16 20:22:37 bostic Exp $
00008  */
00009 
00010 package collections.ship.marshal;
00011 
00012 import java.io.Serializable;
00013 
00014 import com.sleepycat.bind.tuple.TupleInput;
00015 import com.sleepycat.bind.tuple.TupleOutput;
00016 
00034 public class Part implements Serializable, MarshalledEnt {
00035 
00036     private transient String number;
00037     private String name;
00038     private String color;
00039     private Weight weight;
00040     private String city;
00041 
00042     public Part(String number, String name, String color, Weight weight,
00043                 String city) {
00044 
00045         this.number = number;
00046         this.name = name;
00047         this.color = color;
00048         this.weight = weight;
00049         this.city = city;
00050     }
00051 
00056     final void setKey(String number) {
00057 
00058         this.number = number;
00059     }
00060 
00061     public final String getNumber() {
00062 
00063         return number;
00064     }
00065 
00066     public final String getName() {
00067 
00068         return name;
00069     }
00070 
00071     public final String getColor() {
00072 
00073         return color;
00074     }
00075 
00076     public final Weight getWeight() {
00077 
00078         return weight;
00079     }
00080 
00081     public final String getCity() {
00082 
00083         return city;
00084     }
00085 
00086     public String toString() {
00087 
00088         return "[Part: number=" + number +
00089                " name=" + name +
00090                " color=" + color +
00091                " weight=" + weight +
00092                " city=" + city + ']';
00093     }
00094 
00095     // --- MarshalledEnt implementation ---
00096 
00097     Part() {
00098 
00099         // A no-argument constructor is necessary only to allow the binding to
00100         // instantiate objects of this class.
00101     }
00102 
00103     public void unmarshalPrimaryKey(TupleInput keyInput) {
00104 
00105         this.number = keyInput.readString();
00106     }
00107 
00108     public void marshalPrimaryKey(TupleOutput keyOutput) {
00109 
00110         keyOutput.writeString(this.number);
00111     }
00112 
00113     public boolean marshalSecondaryKey(String keyName, TupleOutput keyOutput) {
00114 
00115         throw new UnsupportedOperationException(keyName);
00116     }
00117 }

Generated on Sun Dec 25 12:14:27 2005 for Berkeley DB 4.4.16 by  doxygen 1.4.2