Class DynamicBean

  • All Implemented Interfaces:
    net.sf.cglib.proxy.Callback, net.sf.cglib.proxy.MethodInterceptor

    public class DynamicBean
    extends java.lang.Object
    implements net.sf.cglib.proxy.MethodInterceptor
    Class which represents a generic bean
    Author:
    Andrew Varley
    • Constructor Summary

      Constructors 
      Constructor Description
      DynamicBean()
      Construct the interceptor
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static FastPathObject create​(java.lang.Class<? extends FastPathObject> clazz, java.lang.Class<?>[] inter)
      Create a DynamicBean
      java.util.Map<java.lang.String,​java.lang.Object> getMap()
      Getter for the map, for testing purposes
      java.lang.Object intercept​(java.lang.Object obj, java.lang.reflect.Method method, java.lang.Object[] args, net.sf.cglib.proxy.MethodProxy proxy)
      Intercept all method calls, and operate on Map.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • DynamicBean

        public DynamicBean()
        Construct the interceptor
    • Method Detail

      • create

        public static FastPathObject create​(java.lang.Class<? extends FastPathObject> clazz,
                                            java.lang.Class<?>[] inter)
        Create a DynamicBean
        Parameters:
        clazz - the class to extend
        inter - the interfaces to implement
        Returns:
        the DynamicBean
      • intercept

        public java.lang.Object intercept​(java.lang.Object obj,
                                          java.lang.reflect.Method method,
                                          java.lang.Object[] args,
                                          net.sf.cglib.proxy.MethodProxy proxy)
                                   throws java.lang.Throwable
        Intercept all method calls, and operate on Map. Note that final methods (eg. getClass) cannot be intercepted
        Specified by:
        intercept in interface net.sf.cglib.proxy.MethodInterceptor
        Parameters:
        obj - the proxy
        method - the method called
        args - the parameters
        proxy - the method proxy
        Returns:
        the return value of the real method call
        Throws:
        java.lang.Throwable - if an error occurs in executing the real method
      • getMap

        public java.util.Map<java.lang.String,​java.lang.Object> getMap()
        Getter for the map, for testing purposes
        Returns:
        a map of data for this object