Package org.apache.commons.io.channels
Class CloseShieldChannelHandler
- java.lang.Object
-
- org.apache.commons.io.channels.CloseShieldChannelHandler
-
- All Implemented Interfaces:
java.lang.reflect.InvocationHandler
final class CloseShieldChannelHandler extends java.lang.Object implements java.lang.reflect.InvocationHandlerAnInvocationHandlersupporting the implementation ofCloseShieldChannel.
-
-
Field Summary
Fields Modifier and Type Field Description private booleanclosedprivate java.nio.channels.Channeldelegateprivate static java.util.Set<java.lang.Class<? extends java.nio.channels.Channel>>SUPPORTED_INTERFACES
-
Constructor Summary
Constructors Constructor Description CloseShieldChannelHandler(java.nio.channels.Channel delegate)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Objectinvoke(java.lang.Object proxy, java.lang.reflect.Method method, java.lang.Object[] args)private java.lang.ObjectinvokeObjectMethod(java.lang.Object proxy, java.lang.reflect.Method method, java.lang.Object[] args)private static booleanisAllowedAfterClose(java.lang.Class<?> declaringClass, java.lang.String name, int parameterCount)Tests whether the given method is allowed to be called after the shield is closed.(package private) static booleanisSupported(java.lang.Class<?> interfaceClass)private static booleanreturnsThis(java.lang.Class<?> declaringClass, java.lang.String name, int parameterCount)Tests whether the given method returns 'this' (the channel) as per JDK spec.
-
-
-
Method Detail
-
isAllowedAfterClose
private static boolean isAllowedAfterClose(java.lang.Class<?> declaringClass, java.lang.String name, int parameterCount)Tests whether the given method is allowed to be called after the shield is closed.- Parameters:
declaringClass- The class declaring the method.name- The method name.parameterCount- The number of parameters.- Returns:
trueif the method is allowed afterclose(),falseotherwise.
-
isSupported
static boolean isSupported(java.lang.Class<?> interfaceClass)
-
returnsThis
private static boolean returnsThis(java.lang.Class<?> declaringClass, java.lang.String name, int parameterCount)Tests whether the given method returns 'this' (the channel) as per JDK spec.- Parameters:
declaringClass- The class declaring the method.name- The method name.parameterCount- The number of parameters.- Returns:
trueif the method returns 'this',falseotherwise.
-
invoke
public java.lang.Object invoke(java.lang.Object proxy, java.lang.reflect.Method method, java.lang.Object[] args) throws java.lang.Throwable- Specified by:
invokein interfacejava.lang.reflect.InvocationHandler- Throws:
java.lang.Throwable
-
invokeObjectMethod
private java.lang.Object invokeObjectMethod(java.lang.Object proxy, java.lang.reflect.Method method, java.lang.Object[] args)
-
-