public abstract class AbstractInvocationHandler extends Object implements InvocationHandler
Subclasses should override the doInvoke(Object, Method, Object[])
method to provide custom
handling for method invocations.
Modifier | Constructor and Description |
---|---|
protected |
AbstractInvocationHandler(Type definedClass)
Constructs a new invocation handler for the specified type.
|
Modifier and Type | Method and Description |
---|---|
protected abstract Object |
doInvoke(Object proxy,
Method method,
Object[] args)
Handles the actual invocation of the method.
|
Object |
invoke(Object proxy,
Method method,
Object[] args)
Handles method invocations on proxy instances.
|
void |
onClose(Closeable closeable)
Sets a Closeable that should be called when close() is called on this invocation handler.
|
protected AbstractInvocationHandler(Type definedClass)
definedClass
- The type for which the invocation handler is defined.public final Object invoke(Object proxy, Method method, Object[] args) throws Throwable
invoke
in interface InvocationHandler
proxy
- The proxy instance.method
- The method being called.args
- The arguments for the method call.Throwable
- if an error occurs during method invocation.protected abstract Object doInvoke(Object proxy, Method method, Object[] args) throws InvocationTargetException, IllegalAccessException, IllegalStateException, BufferOverflowException, BufferUnderflowException, IllegalArgumentException, ArithmeticException, InvalidMarshallableException
proxy
- The proxy instance.method
- The method being called.args
- The arguments for the method call.InvocationTargetException
- if the method being called throws an exception.IllegalAccessException
- if this InvocationHandler
does not have access to the method.IllegalStateException
- if the proxy is in an inappropriate state for the method call.BufferOverflowException
- if the buffer overflows during method invocation.BufferUnderflowException
- if the buffer underflows during method invocation.IllegalArgumentException
- if the method receives illegal arguments.ArithmeticException
- if an arithmetic exception occurs during method invocation.InvalidMarshallableException
- if the object being marshaled is invalid.public void onClose(Closeable closeable)
closeable
- The Closeable to be invoked when close() is called.Copyright © 2023. All rights reserved.