org.obligate.annotations.contract.proxy
Class ContractProxy

java.lang.Object
  extended by org.obligate.annotations.contract.proxy.ContractProxy
All Implemented Interfaces:
java.lang.reflect.InvocationHandler, ContractVariables
Direct Known Subclasses:
DirectContractProxy, IndirectContractProxy

public abstract class ContractProxy
extends java.lang.Object
implements java.lang.reflect.InvocationHandler, ContractVariables

A dynamic proxy that looks for the contract annotations and applies them to the call and the result.

Since:
14-Jan-2006
Author:
Steve Jones

Field Summary
 
Fields inherited from interface org.obligate.annotations.contract.proxy.ContractVariables
POSTCONDITION_ID, PRECONDITION_ID
 
Constructor Summary
ContractProxy()
           
 
Method Summary
protected  boolean doValidation()
           
protected abstract  java.lang.Object internalInvocation(java.lang.reflect.Method method, java.lang.Object[] arguments)
          The abstract method that needs to be implemented to perform the actual call
 java.lang.Object invoke(java.lang.Object proxy, java.lang.reflect.Method method, java.lang.Object[] arguments)
           
protected static java.lang.String toMethodCallString(java.lang.reflect.Method method)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ContractProxy

public ContractProxy()
Method Detail

internalInvocation

protected abstract java.lang.Object internalInvocation(java.lang.reflect.Method method,
                                                       java.lang.Object[] arguments)
                                                throws java.lang.Throwable
The abstract method that needs to be implemented to perform the actual call

Parameters:
method - the method to call
arguments - the arguments for the call
Returns:
the result of the call
Throws:
java.lang.Throwable

doValidation

protected final boolean doValidation()

invoke

public java.lang.Object invoke(java.lang.Object proxy,
                               java.lang.reflect.Method method,
                               java.lang.Object[] arguments)
                        throws java.lang.Throwable
Specified by:
invoke in interface java.lang.reflect.InvocationHandler
Throws:
java.lang.Throwable
See Also:
InvocationHandler.invoke(java.lang.Object, java.lang.reflect.Method, java.lang.Object[])

toMethodCallString

protected static final java.lang.String toMethodCallString(java.lang.reflect.Method method)