From 19c941cc3f39d0a856311b323f8f28e5e07b0edc Mon Sep 17 00:00:00 2001 From: "Brian S. O'Neill" Date: Tue, 22 Jan 2008 02:50:57 +0000 Subject: OrderingList is now Serializable. --- .../java/com/amazon/carbonado/qe/OrderingList.java | 40 +++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) (limited to 'src/main/java/com/amazon/carbonado/qe') diff --git a/src/main/java/com/amazon/carbonado/qe/OrderingList.java b/src/main/java/com/amazon/carbonado/qe/OrderingList.java index d100cc9..b6235ac 100644 --- a/src/main/java/com/amazon/carbonado/qe/OrderingList.java +++ b/src/main/java/com/amazon/carbonado/qe/OrderingList.java @@ -18,6 +18,12 @@ package com.amazon.carbonado.qe; +import java.io.Externalizable; +import java.io.IOException; +import java.io.ObjectInput; +import java.io.ObjectOutput; +import java.io.Serializable; + import java.util.AbstractList; import java.util.HashMap; import java.util.HashSet; @@ -40,7 +46,9 @@ import com.amazon.carbonado.info.StorableIntrospector; * * @author Brian S O'Neill */ -public class OrderingList extends AbstractList> { +public class OrderingList extends AbstractList> + implements Serializable +{ private static final OrderingList EMPTY_LIST = new OrderingList(); private static final Map cCache; @@ -347,4 +355,34 @@ public class OrderingList extends AbstractList[] mOrderings; + + // Required for Externalizable. + public Orderings() { + } + + Orderings(OrderedProperty[] orderings) { + mOrderings = orderings; + } + + public void writeExternal(ObjectOutput out) throws IOException { + out.writeObject(mOrderings); + } + + public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { + mOrderings = (OrderedProperty[]) in.readObject(); + } + + private Object readResolve() { + return OrderingList.get(mOrderings); + } + } } -- cgit v1.2.3