001 // Copyright 2008 Waterken Inc. under the terms of the MIT X license
002 // found at http://www.opensource.org/licenses/mit-license.html
003 package org.ref_send.promise;
004
005 import java.io.Serializable;
006
007 import org.joe_e.Struct;
008 import org.ref_send.Record;
009 import org.ref_send.deserializer;
010 import org.ref_send.name;
011
012 /**
013 * A return from a {@linkplain Eventual#spawn vat creation}.
014 */
015 public class
016 Vat<T> extends Struct implements Record, Serializable {
017 static private final long serialVersionUID = 1L;
018
019 /**
020 * object created by the vat's maker
021 */
022 public final T top;
023
024 /**
025 * destruct the vat
026 * <p>
027 * call like: <code>destruct.apply(null)</code>
028 * </p>
029 */
030 public final Receiver<?> destruct;
031
032 /**
033 * Constructs an instance.
034 * @param top {@link #top}
035 * @param destruct {@link #destruct}
036 */
037 public @deserializer
038 Vat(@name("top") final T top,
039 @name("destruct") final Receiver<?> destruct) {
040 this.top = top;
041 this.destruct = destruct;
042 }
043 }