org.jomc.ri
Class DefaultInvoker

Package class diagram package DefaultInvoker
java.lang.Object
  extended by org.jomc.ri.DefaultInvoker
All Implemented Interfaces:
Invoker

@Generated(value="org.jomc.tools.SourceFileProcessor 1.2.2",
           comments="See http://jomc.sourceforge.net/jomc/1.2/jomc-tools-1.2.2")
public class DefaultInvoker
extends Object
implements Invoker

Default Invoker implementation.

Identifier:
org.jomc.ri.DefaultInvoker
Name:
JOMC RI
Abstract:
No
Final:
No
Stateless:
No

Version:
1.0
Author:
Christian Schulte 1.0

Constructor Summary
DefaultInvoker()
          Creates a new DefaultInvoker instance.
 
Method Summary
 void handleException(Invocation invocation, Throwable t)
          Called whenever an exception has been caught.
 Object invoke(Invocation invocation)
          Performs a method invocation on an object.
 Invocation postInvoke(Invocation invocation)
          Called after an invocation has been performed.
 Invocation preInvoke(Invocation invocation)
          Called before an invocation is performed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultInvoker

@Generated(value="org.jomc.tools.SourceFileProcessor 1.2.2",
           comments="See http://jomc.sourceforge.net/jomc/1.2/jomc-tools-1.2.2")
public DefaultInvoker()
Creates a new DefaultInvoker instance.

Method Detail

invoke

public Object invoke(Invocation invocation)
              throws Throwable
Performs a method invocation on an object.

This method first passes the given invocation to the preInvoke method. If the result property of the invocation returned by the preInvoke method is an instance of Throwable, that instance will be thrown; otherwise the invocation returned by the preInvoke method is performed and then passed to the postInvoke method. If the result property of the invocation returned from the postInvoke method is an instance of Throwable, that instance will be thrown; otherwise the value of the result property is returned by this method.

Specified by:
invoke in interface Invoker
Parameters:
invocation - The invocation to perform.
Returns:
The return value of the invocation. If the declared return type of the method of the invocation is a primitive type, then the value returned by this method must be an instance of the corresponding primitive wrapper class; otherwise, it must be a type assignable to the declared return type of the method of the invocation. If the value returned by this method is null and the declared return type of the method of the invocation is primitive, then a NullPointerException will be thrown. If the value returned by this method is otherwise not compatible to the declared return type of the method of the invocation, a ClassCastException will be thrown.
Throws:
Throwable - The exception thrown from the method invocation. The exception's type must be assignable either to any of the exception types declared in the throws clause of the method of the invocation or to the unchecked exception types java.lang.RuntimeException or java.lang.Error. If a checked exception is thrown by this method that is not assignable to any of the exception types declared in the throws clause of the method of the invocation, then an UndeclaredThrowableException containing the exception that was thrown by this method will be thrown.
See Also:
preInvoke(org.jomc.spi.Invocation), postInvoke(org.jomc.spi.Invocation)

preInvoke

public Invocation preInvoke(Invocation invocation)
Called before an invocation is performed.

Overriding classes may use this method to perform any kind of operation prior to an invocation and to create custom invocation instances. If an overriding class wishes to throw an exception, it may do so by setting the result property of the returned invocation to an instance of Throwable thrown as the result of the invocation. If an overriding class wishes to provide a custom Invocation class, it may do so by returning a different instance from this method. By default, this method does nothing and returns the given invocation unchanged.

Parameters:
invocation - The invocation about to be performed.
Returns:
The processed invocation.
Throws:
NullPointerException - if invocation is null.

postInvoke

public Invocation postInvoke(Invocation invocation)
Called after an invocation has been performed.

Overriding classes may use this method to perform any kind of operation after an invocation has been performed and to maintain custom invocation instances. If an overriding class wishes to throw an exception, it may do so by setting the result property of the returned invocation to an instance of Throwable thrown as the result of the invocation. Since the result property of the given invocation already holds the result of the invocation (which may already be an instance of Throwable), care must be taken when updating that result. By default, this method does nothing and returns the given invocation unchanged.

Parameters:
invocation - The performed invocation.
Returns:
The processed invocation.
Throws:
NullPointerException - if invocation is null.

handleException

public void handleException(Invocation invocation,
                            Throwable t)
Called whenever an exception has been caught.

Overriding classes may use this method for handling exceptions. By default, this method updates the result of the given invocation with the given throwable. If that throwable is an instance of InvocationTargetException, this method updates the result with the value of that exception's target exception. If the result of the given invocation already is an instance of Throwable, this method does not update the result.

Parameters:
invocation - The invocation to update.
t - The throwable to update invocation with.


Copyright © 2005-2012 The JOMC Project. All Rights Reserved.Get JOMC at SourceForge.net. Fast, secure and Free Open Source software downloads
Please note that this documentation is maintained by non-native english speaking authors. As such, you may encounter phrases or wordings which seem imprecise or may even have a totally different meaning to native english speaking readers than what the individual author was trying to express. If you are a native english speaking reader and find any such phrases or wordings we kindly ask you to send an email to the corresponding author and help us improve this documentation in order to avoid misunderstandings. You will find the authors' email addresses at the top of each class. Please accept our apologies for any inconvenience caused.