Package org.jboss.seam.util

Examples of org.jboss.seam.util.ProxyFactory

Then, the following method call will be forwarded to MethodHandler mi and prints a message before executing the originally called method bar() in Foo.

The last three lines of the code shown above can be replaced with a call to the helper method create, which generates a proxy class, instantiates it, and sets the method handler of the instance:

To change the method handler during runtime, execute the following code:

You can also specify the default method handler:

The default handler is implicitly attached to an instance of the generated class c2. Calling setHandler on the instance is not necessary unless another method handler must be attached to the instance.

The following code is an example of method handler. It does not execute anything except invoking the original method:

A proxy object generated by ProxyFactory is serializable if its super class or interfaces implement a java.io.Serializable. However, a serialized proxy object will not be compatible with future releases. The serialization support should be used for short-term storage or RMI. @see MethodHandler @since 3.1


      else
      {
         interfaces.add(HttpSessionActivationListener.class);
         interfaces.add(Mutable.class);
      }
      ProxyFactory factory = new ProxyFactory();
      factory.setSuperclass( type==JAVA_BEAN ? beanClass : Object.class );
      factory.setInterfaces( interfaces.toArray( new Class[0] ) );
      factory.setFilter(FINALIZE_FILTER);
      return factory.createClass();
   }
View Full Code Here


         interfaces.add(Mutable.class);
      }
      interfaces.add(Instance.class);
      interfaces.add(Proxy.class);

      ProxyFactory factory = new ProxyFactory()
      {
         @Override
         protected ClassLoader getClassLoader()
         {
            return beanClass.getClassLoader();
         }
      };
      factory.setSuperclass( type==JAVA_BEAN ? beanClass : Object.class );
      factory.setInterfaces( interfaces.toArray( new Class[0] ) );
      factory.setFilter(FINALIZE_FILTER);
      return factory.createClass();
   }
View Full Code Here

      return name;
   }
  
   public static Class<ProxyObject> createProxyFactory(final Class beanClass)
   {
      ProxyFactory factory = new ProxyFactory();
      if (beanClass.isInterface())
      {
         factory.setInterfaces(new Class[] {beanClass, Serializable.class});
      }
      else
      {
         factory.setSuperclass( beanClass );
      }
      return factory.createClass();
   }
View Full Code Here

      else
      {
         interfaces.add(HttpSessionActivationListener.class);
         interfaces.add(Mutable.class);
      }
      ProxyFactory factory = new ProxyFactory();
      factory.setSuperclass( type==JAVA_BEAN ? beanClass : Object.class );
      factory.setInterfaces( interfaces.toArray( new Class[0] ) );
      factory.setFilter(FINALIZE_FILTER);
      return factory.createClass();
   }
View Full Code Here

      else
      {
         interfaces.add(HttpSessionActivationListener.class);
         interfaces.add(Mutable.class);
      }
      ProxyFactory factory = new ProxyFactory();
      factory.setSuperclass( type==JAVA_BEAN ? beanClass : Object.class );
      factory.setInterfaces( interfaces.toArray( new Class[0] ) );
      factory.setFilter(FINALIZE_FILTER);
      return factory.createClass();
   }
View Full Code Here

         interfaces.add(Mutable.class);
      }
      interfaces.add(Instance.class);
      interfaces.add(Proxy.class);

      ProxyFactory factory = new ProxyFactory();
      factory.setSuperclass( type==JAVA_BEAN ? beanClass : Object.class );
      factory.setInterfaces( interfaces.toArray( new Class[0] ) );
      factory.setFilter(FINALIZE_FILTER);
      return factory.createClass();
   }
View Full Code Here

      else
      {
         interfaces.add(HttpSessionActivationListener.class);
         interfaces.add(Mutable.class);
      }
      ProxyFactory factory = new ProxyFactory();
      factory.setSuperclass( type==JAVA_BEAN ? beanClass : Object.class );
      factory.setInterfaces( interfaces.toArray( new Class[0] ) );
      factory.setFilter(FINALIZE_FILTER);
      return factory.createClass();
   }
View Full Code Here

         interfaces.add(Mutable.class);
      }
      interfaces.add(Instance.class);
      interfaces.add(Proxy.class);

      ProxyFactory factory = new ProxyFactory();
      factory.setSuperclass( type==JAVA_BEAN ? beanClass : Object.class );
      factory.setInterfaces( interfaces.toArray( new Class[0] ) );
      factory.setFilter(FINALIZE_FILTER);
      return factory.createClass();
   }
View Full Code Here

         interfaces.add(Mutable.class);
      }
      interfaces.add(Instance.class);
      interfaces.add(Proxy.class);

      ProxyFactory factory = new ProxyFactory();
      factory.setSuperclass( type==JAVA_BEAN ? beanClass : Object.class );
      factory.setInterfaces( interfaces.toArray( new Class[0] ) );
      factory.setFilter(FINALIZE_FILTER);
      return factory.createClass();
   }
View Full Code Here

TOP

Related Classes of org.jboss.seam.util.ProxyFactory

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.