ref_send API 1.16
defensive programming in Java

org.ref_send.promise
Class Rejected<T>

java.lang.Object
  extended by org.ref_send.promise.Rejected<T>
Type Parameters:
T - referent type
All Implemented Interfaces:
java.io.Serializable, java.lang.reflect.InvocationHandler, Immutable, Powerless, Selfless, Promise<T>, Volatile<T>, Record

public final class Rejected<T>
extends java.lang.Object
implements Promise<T>, java.lang.reflect.InvocationHandler, Powerless, Selfless, Record, java.io.Serializable

A rejected promise.

See Also:
Serialized Form

Field Summary
 java.lang.Exception reason
          reason for rejecting the promise
 
Constructor Summary
Rejected(java.lang.Exception reason)
          Construct an instance.
 
Method Summary
 T _(java.lang.Class type)
          Creates a rejected reference.
 T cast()
          Throws the reason.
 boolean equals(java.lang.Object x)
          Is the given object the same?
 int hashCode()
          Calculates the hash code.
 java.lang.Object invoke(java.lang.Object proxy, java.lang.reflect.Method method, java.lang.Object[] args)
          Forwards a Java language invocation.
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

reason

public final java.lang.Exception reason
reason for rejecting the promise

Constructor Detail

Rejected

public Rejected(java.lang.Exception reason)
Construct an instance.

Parameters:
reason - reason
Method Detail

equals

public boolean equals(java.lang.Object x)
Is the given object the same?

Overrides:
equals in class java.lang.Object
Parameters:
x - compared to object
Returns:
true if the same, else false

hashCode

public int hashCode()
Calculates the hash code.

Specified by:
hashCode in interface Selfless
Overrides:
hashCode in class java.lang.Object

cast

public T cast()
       throws java.lang.Exception
Throws the reason.

Specified by:
cast in interface Volatile<T>
Throws:
java.lang.Exception - reason

invoke

public java.lang.Object invoke(java.lang.Object proxy,
                               java.lang.reflect.Method method,
                               java.lang.Object[] args)
                        throws java.lang.Exception
Forwards a Java language invocation.

Specified by:
invoke in interface java.lang.reflect.InvocationHandler
Parameters:
proxy - eventual reference
method - method to invoke
args - invocation arguments
Returns:
eventual reference for the invocation return
Throws:
java.lang.Exception - problem invoking an Object method
java.lang.Error - method return cannot be eventualized

_

public T _(java.lang.Class type)
Creates a rejected reference.

Parameters:
type - referent type, MUST be an allowed proxy type
Throws:
java.lang.Error - invalid type argument

ref_send API 1.16
defensive programming in Java

Submit a bug or feature, or get help

Copyright 1998-2007 Waterken Inc. under the terms of the MIT X license.