Package de.hybris.platform.commons.jalo
Class CommonsManager.ItemMethodInterceptor
- java.lang.Object
-
- de.hybris.platform.commons.jalo.CommonsManager.ItemMethodInterceptor
-
- All Implemented Interfaces:
JaloObjectCreator
,net.sf.cglib.proxy.Callback
,net.sf.cglib.proxy.CallbackFilter
,net.sf.cglib.proxy.MethodInterceptor
- Enclosing class:
- CommonsManager
public static class CommonsManager.ItemMethodInterceptor extends java.lang.Object implements net.sf.cglib.proxy.MethodInterceptor, JaloObjectCreator, net.sf.cglib.proxy.CallbackFilter
-
-
Constructor Summary
Constructors Constructor Description ItemMethodInterceptor(java.lang.Class<? extends Item> itemClass, java.lang.reflect.Method... methods)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
accept(java.lang.reflect.Method method)
To keep the generated class light enough we define which methods we'd like to intercept here.protected java.lang.Object
after(Item i, java.lang.reflect.Method m, java.lang.Object[] originalArgs, java.lang.Object[] args, java.lang.Object returned)
Called after the actual method call.protected java.lang.Object[]
before(Item p, java.lang.reflect.Method m, java.lang.Object[] args)
Called before the actual method call.protected java.lang.Object
call(Item obj, java.lang.Object[] args, net.sf.cglib.proxy.MethodProxy proxy)
BridgeAbstraction
createInstance(Tenant tenant, BridgeInterface impl)
Here we're creating a jalo item instance.java.lang.Object
intercept(java.lang.Object obj, java.lang.reflect.Method method, java.lang.Object[] args, net.sf.cglib.proxy.MethodProxy methodproxy)
Intercepts all target method calls and wraps the actual call intobefore(Item, Method, Object[])
andafter(Item, Method, Object[], Object[], Object)
.
-
-
-
Constructor Detail
-
ItemMethodInterceptor
public ItemMethodInterceptor(java.lang.Class<? extends Item> itemClass, java.lang.reflect.Method... methods)
-
-
Method Detail
-
intercept
public final java.lang.Object intercept(java.lang.Object obj, java.lang.reflect.Method method, java.lang.Object[] args, net.sf.cglib.proxy.MethodProxy methodproxy) throws java.lang.Throwable
Intercepts all target method calls and wraps the actual call intobefore(Item, Method, Object[])
andafter(Item, Method, Object[], Object[], Object)
.- Specified by:
intercept
in interfacenet.sf.cglib.proxy.MethodInterceptor
- Throws:
java.lang.Throwable
-
before
protected java.lang.Object[] before(Item p, java.lang.reflect.Method m, java.lang.Object[] args)
Called before the actual method call. It is possible to return different arguments here. By default this method simply returns the original arguments.- Parameters:
m
- the methodargs
- the original arguments- Returns:
- the arguments to be used for calling the actual method
-
after
protected java.lang.Object after(Item i, java.lang.reflect.Method m, java.lang.Object[] originalArgs, java.lang.Object[] args, java.lang.Object returned)
Called after the actual method call. By default this method simply passes on the original result.- Parameters:
i
- the itemm
- the methodoriginalArgs
- the original arguments before the callargs
- the arguments used for the actual callreturned
- the result of the actual call- Returns:
- the result to be returned as method call result
-
call
protected java.lang.Object call(Item obj, java.lang.Object[] args, net.sf.cglib.proxy.MethodProxy proxy) throws java.lang.Throwable
- Throws:
java.lang.Throwable
-
createInstance
public BridgeAbstraction createInstance(Tenant tenant, BridgeInterface impl)
Here we're creating a jalo item instance. Later on it will be connected to its persistence delegate so don't try to invoke any business method here !- Specified by:
createInstance
in interfaceJaloObjectCreator
-
accept
public int accept(java.lang.reflect.Method method)
To keep the generated class light enough we define which methods we'd like to intercept here. This method maps untouched methods to 0 and all intercepted methods to 1 according to the configured callbacks inside ourEnhancer
.- Specified by:
accept
in interfacenet.sf.cglib.proxy.CallbackFilter
-
-