public class EchoDecorator<T> extends Decorator<T>
Decorator
implementation that echoes any invocation to a PrintWriter
.
The implementation will try to create new proxies for every return value, that can be proxied by the
ProxyFactory
in use.
Constructor and Description |
---|
EchoDecorator(PrintWriter out,
ProxyFactory factory)
Construct an EchoingDecorator.
|
Modifier and Type | Method and Description |
---|---|
Object[] |
beforeMethodStarts(T proxy,
Method method,
Object[] args)
Called before a method is invoked on an object, to possibly decorate the arguments being passed to the method
invocation.
|
Exception |
decorateInvocationException(T proxy,
Method method,
Object[] args,
Exception cause)
Called when a method cannot be invoked, to possibly decorate the type of error.
|
Object |
decorateResult(T proxy,
Method method,
Object[] args,
Object result)
Called on the way back from a method invocation, to possibly decorate the result.
|
Throwable |
decorateTargetException(T proxy,
Method method,
Object[] args,
Throwable cause)
Called when a called method fails, to possibly decorate the type of error.
|
public EchoDecorator(PrintWriter out, ProxyFactory factory)
out
- the PrintWriter
receiving the logsfactory
- the ProxyFactory
to usepublic Object[] beforeMethodStarts(T proxy, Method method, Object[] args)
Decorator
beforeMethodStarts
in class Decorator<T>
proxy
- the proxy the method will be invoked onmethod
- the method to be invokedargs
- the arguments being passed to the methodpublic Object decorateResult(T proxy, Method method, Object[] args, Object result)
Decorator
decorateResult
in class Decorator<T>
proxy
- the proxy the method was be invoked onmethod
- the invoked methodargs
- the arguments passed to the methodresult
- the result of the method invocationpublic Throwable decorateTargetException(T proxy, Method method, Object[] args, Throwable cause)
Decorator
decorateTargetException
in class Decorator<T>
proxy
- the proxy the method was be invoked onmethod
- the invoked methodargs
- the arguments passed to the methodcause
- the original exception thrownpublic Exception decorateInvocationException(T proxy, Method method, Object[] args, Exception cause)
Decorator
decorateInvocationException
in class Decorator<T>
proxy
- the proxy the method was be invoked onmethod
- the invoked methodargs
- the arguments passed to the methodcause
- the original exception thrownCopyright © 2005–2021 Codehaus. All rights reserved.