001 // Copyright 2005-2006 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 an {@linkplain Eventual#defer explicit promise creation}. 014 * <p> 015 * This class represents the reified {@linkplain Promise tail} and 016 * {@linkplain Resolver head} of a reference: 017 * {@link #promise -}{@code -}{@link #resolver >}. 018 * </p> 019 * @param <T> referent type 020 */ 021 public class 022 Deferred<T> extends Struct implements Record, Serializable { 023 static private final long serialVersionUID = 1L; 024 025 /** 026 * permission to access the referent 027 */ 028 public final Promise<T> promise; 029 030 /** 031 * permission to resolve the referent 032 */ 033 public final Resolver<T> resolver; 034 035 /** 036 * Constructs an instance. 037 * @param promise {@link #promise} 038 * @param resolver {@link #resolver} 039 */ 040 public @deserializer 041 Deferred(@name("promise") final Promise<T> promise, 042 @name("resolver") final Resolver<T> resolver) { 043 this.promise = promise; 044 this.resolver = resolver; 045 } 046 }