Class 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 into before(Item, Method, Object[]) and after(Item, Method, Object[], Object[], Object).
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface net.sf.cglib.proxy.CallbackFilter

        equals
    • 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 into before(Item, Method, Object[]) and after(Item, Method, Object[], Object[], Object).
        Specified by:
        intercept in interface net.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 method
        args - 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 item
        m - the method
        originalArgs - the original arguments before the call
        args - the arguments used for the actual call
        returned - 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
      • 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 our Enhancer.
        Specified by:
        accept in interface net.sf.cglib.proxy.CallbackFilter