org.apache.tapestry5.ioc.internal.services
Class AbstractInvocation

java.lang.Object
  extended by org.apache.tapestry5.ioc.internal.services.AbstractInvocation
All Implemented Interfaces:
Invocation

public abstract class AbstractInvocation
extends java.lang.Object
implements Invocation

Base class for Invocation, which is extended with a dynamically generated class generated for each individual class and method.


Constructor Summary
protected AbstractInvocation(MethodInfo methodInfo)
           
 
Method Summary
 java.lang.String getMethodName()
          Returns the name of the method being invoked.
 int getParameterCount()
          Returns the number of parameters passed to the method.
 java.lang.Class getParameterType(int index)
          Returns the type of the parameter at the index.
 java.lang.Object getResult()
          The return value after Invocation.proceed(), which may be null.
 java.lang.Class getResultType()
          Returns the type of the method result, which may be a primitive type (i.e., int.class) or even void (void.class).
<T extends java.lang.Throwable>
T
getThrown(java.lang.Class<T> throwableClass)
          After invoking Invocation.proceed(), used to obtain the thrown (checked) exception, if assignable to the provided type.
protected abstract  void invokeDelegateMethod()
          This method is filled in, in the dynamically generated subclass.
 boolean isFail()
          If true, then the proceeded invocation threw a checked exception.
 void overrideResult(java.lang.Object newResult)
          Overrides the result.
 void overrideThrown(java.lang.Exception thrown)
          Overrides the thrown exception.
 void proceed()
          Proceed with the invocation of the advised method.
 void rethrow()
          If the invocation failed (with a checked exception), then rethrow the exception wrapped in a RuntimeException.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.tapestry5.ioc.Invocation
getParameter, override
 

Constructor Detail

AbstractInvocation

protected AbstractInvocation(MethodInfo methodInfo)
Method Detail

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getMethodName

public java.lang.String getMethodName()
Description copied from interface: Invocation
Returns the name of the method being invoked.

Specified by:
getMethodName in interface Invocation

getResultType

public java.lang.Class getResultType()
Description copied from interface: Invocation
Returns the type of the method result, which may be a primitive type (i.e., int.class) or even void (void.class).

Specified by:
getResultType in interface Invocation

getParameterCount

public int getParameterCount()
Description copied from interface: Invocation
Returns the number of parameters passed to the method.

Specified by:
getParameterCount in interface Invocation

getParameterType

public java.lang.Class getParameterType(int index)
Description copied from interface: Invocation
Returns the type of the parameter at the index.

Specified by:
getParameterType in interface Invocation

isFail

public boolean isFail()
Description copied from interface: Invocation
If true, then the proceeded invocation threw a checked exception.

Specified by:
isFail in interface Invocation

rethrow

public void rethrow()
Description copied from interface: Invocation
If the invocation failed (with a checked exception), then rethrow the exception wrapped in a RuntimeException.

Specified by:
rethrow in interface Invocation

getThrown

public <T extends java.lang.Throwable> T getThrown(java.lang.Class<T> throwableClass)
Description copied from interface: Invocation
After invoking Invocation.proceed(), used to obtain the thrown (checked) exception, if assignable to the provided type.

Specified by:
getThrown in interface Invocation
Parameters:
throwableClass - the type of exception to match
Returns:
the exception, if the proceeded invocation threw a checked exception, and the exception is assignable to the provided type. In other cases, null is returned.

overrideThrown

public void overrideThrown(java.lang.Exception thrown)
Description copied from interface: Invocation
Overrides the thrown exception. The passed exception should be a checked exception of the method. Note that for runtime exceptions, or even Errors, those can just be thrown. Sets the fail flag.

Specified by:
overrideThrown in interface Invocation

getResult

public java.lang.Object getResult()
Description copied from interface: Invocation
The return value after Invocation.proceed(), which may be null.

Specified by:
getResult in interface Invocation

overrideResult

public void overrideResult(java.lang.Object newResult)
Description copied from interface: Invocation
Overrides the result. Clears the thrown exception (if any).

Specified by:
overrideResult in interface Invocation

proceed

public void proceed()
Description copied from interface: Invocation
Proceed with the invocation of the advised method. If the invocation results in a runtime exception, that is thrown. A checked exception is detected by invoking Invocation.isFail().

Specified by:
proceed in interface Invocation

invokeDelegateMethod

protected abstract void invokeDelegateMethod()
This method is filled in, in the dynamically generated subclass.



Copyright © 2006-2010 Apache Software Foundation. All Rights Reserved.