|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jomc.ri.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 class DefaultInvoker
Default Invoker
implementation.
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 |
---|
@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()
DefaultInvoker
instance.
Method Detail |
---|
public Object invoke(Invocation invocation) throws Throwable
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.
invoke
in interface Invoker
invocation
- The invocation to perform.
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.
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.preInvoke(org.jomc.spi.Invocation)
,
postInvoke(org.jomc.spi.Invocation)
public Invocation preInvoke(Invocation invocation)
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.
invocation
- The invocation about to be performed.
NullPointerException
- if invocation
is null
.public Invocation postInvoke(Invocation invocation)
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.
invocation
- The performed invocation.
NullPointerException
- if invocation
is null
.public void handleException(Invocation invocation, Throwable t)
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.
invocation
- The invocation to update.t
- The throwable to update invocation
with.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright © 2005-2012 The JOMC Project. All Rights Reserved. |