org.skife.intercept.interceptors
Class BlockingInterceptor
java.lang.Object
|
+--org.skife.intercept.interceptors.BlockingInterceptor
- All Implemented Interfaces:
- Interceptor
- public class BlockingInterceptor
- extends java.lang.Object
- implements Interceptor
Throws an UnsupportedOperationException
. Typically used
with an interceptor to prevent specific calls, for instance:
InterceptionBroker broker = new InterceptionBroker();
broker.addInterceptor(new BlockingInterceptor("Cannot modify locked JavaBean"), new Signature()
{
public boolean matches(Method m)
{
return (m.getName().startsWith("set") ? true : false);
}
});
// Create a wrapped, javabean-setter blocked version of foo. Note that foo can
// still be modified, but unmodifiableFoo cannot have setXxx(...) called
Foo unmodifiableFoo = (Foo) broker.wrap(foo);
Constructor Summary |
BlockingInterceptor(java.lang.String msg)
Create a new BlockingInterceptor which will throw an exception with the
message set to the argument |
Method Summary |
java.lang.Object |
intercept(java.lang.Object base,
java.lang.reflect.Method method,
java.lang.Object[] args,
org.skife.intercept.InterceptorStack stack)
Throws an UnsupportedOperationException |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
BlockingInterceptor
public BlockingInterceptor(java.lang.String msg)
- Create a new BlockingInterceptor which will throw an exception with the
message set to the argument
- Parameters:
msg
- Message for the UnsupportedOperationException
intercept
public java.lang.Object intercept(java.lang.Object base,
java.lang.reflect.Method method,
java.lang.Object[] args,
org.skife.intercept.InterceptorStack stack)
throws java.lang.Throwable
- Throws an
UnsupportedOperationException
- Specified by:
intercept
in interface Interceptor
- Parameters:
base
- A reference to the base object being interceptedmethod
- A reference to the Method being interceptedargs
- The invocation argumentsstack
- The InterceptorStack
- Returns:
- a value to be returned by the method invocation
java.lang.Throwable