Package javassist.util.proxy

Examples of javassist.util.proxy.ProxyFactory.createClass()


    }

    public void testJira127() throws Exception {
        ProxyFactory proxyFactory = new ProxyFactory();
        proxyFactory.setInterfaces(new Class[]{ JIRA127Sub.class });
        proxyFactory.createClass();
    }

    public interface JIRA127 {
        JIRA127 get();
    }
View Full Code Here


                // ignore finalize()
                return !m.getName().equals("finalize");
            }
        });

        final Class<T> proxySubclass = proxyFactory.createClass();
        try {
            final T newInstance = proxySubclass.newInstance();
            final ProxyObject proxyObject = (ProxyObject) newInstance;
            proxyObject.setHandler(methodHandler);
View Full Code Here

      );
      ProxyFactory factory = new ProxyFactory();
      factory.setSuperclass( interfaces.length == 1 ? persistentClass : null );
      factory.setInterfaces( interfaces );
      factory.setFilter( FINALIZE_FILTER );
      Class cl = factory.createClass();
      final HibernateProxy proxy = ( HibernateProxy ) cl.newInstance();
      ( ( ProxyObject ) proxy ).setHandler( instance );
      instance.constructed = true;
      return proxy;
    }
View Full Code Here

    try {
      ProxyFactory factory = new ProxyFactory();
      factory.setSuperclass( interfaces.length == 1 ? persistentClass : null );
      factory.setInterfaces( interfaces );
      factory.setFilter( FINALIZE_FILTER );
      return factory.createClass();
    }
    catch ( Throwable t ) {
      LOG.error(LOG.javassistEnhancementFailed(persistentClass.getName()), t);
      throw new HibernateException(LOG.javassistEnhancementFailed(persistentClass.getName()), t);
    }
View Full Code Here

         f.setInterfaces(hierarchy);
         f.setSuperclass(superclass);
         f.setFilter(filter);

         proxyType = f.createClass();

         cache.put(type.hashCode(), new WeakReference<Class<?>>(proxyType));
      }

      try
View Full Code Here

         f.setFilter(filter);
         f.setInterfaces(hierarchy);
         f.setSuperclass(superclass);

         proxyType = f.createClass();

         cache.put(type.hashCode(), new WeakReference<Class<?>>(proxyType));
      }

      try
View Full Code Here

                  if (hierarchy.length > 0)
                     f.setInterfaces(hierarchy);

                  f.setFilter(filter);
                  Class<?> c = f.createClass();
                  enhancedResult = c.newInstance();

                  try
                  {
                     ((ProxyObject) enhancedResult)
View Full Code Here

      );
      ProxyFactory factory = new ProxyFactory();
      factory.setSuperclass( interfaces.length == 1 ? persistentClass : null );
      factory.setInterfaces( interfaces );
      factory.setFilter( FINALIZE_FILTER );
      Class cl = factory.createClass();
      final HibernateProxy proxy = ( HibernateProxy ) cl.newInstance();
      ( ( Proxy ) proxy ).setHandler( instance );
      instance.constructed = true;
      return proxy;
    }
View Full Code Here

    try {
      ProxyFactory factory = new ProxyFactory();
      factory.setSuperclass( interfaces.length == 1 ? persistentClass : null );
      factory.setInterfaces( interfaces );
      factory.setFilter( FINALIZE_FILTER );
      return factory.createClass();
    }
    catch ( Throwable t ) {
      LOG.error(LOG.javassistEnhancementFailed(persistentClass.getName()), t);
      throw new HibernateException(LOG.javassistEnhancementFailed(persistentClass.getName()), t);
    }
View Full Code Here

      Class[] interfaces = new Class[2];
      interfaces[0] = serviceRole;
      interfaces[1] = ServiceProxy.class;
      factory.setInterfaces( interfaces );

      Class proxyClass = factory.createClass();
      ProxyObject proxyObject = (ProxyObject) proxyClass.newInstance();
      proxyObject.setHandler( new ServiceProxyMethodInterceptor<T>( (T)proxyObject, serviceRole, serviceRegistry ) );
      return (T) proxyObject;
    }
    catch (Exception e) {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.