Package javassist.util.proxy

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


  }

  public <T> T newInstance(Class<T> classToInstantiate) {
    ProxyFactory proxyFactory = new ProxyFactory();
    proxyFactory.setSuperclass(classToInstantiate);
    Class newClass = proxyFactory.createClass();
    Object instance;
    try {
      instance = newClass.newInstance();
    } catch (Exception e) {
      throw new MappingException(e);
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 ) {
      LoggerFactory.getLogger( BasicLazyInitializer.class ).error(
          "Javassist Enhancement failed: "
          + persistentClass.getName(), t
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

      );
      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 ) {
      LoggerFactory.getLogger( BasicLazyInitializer.class ).error(
          "Javassist Enhancement failed: "
          + persistentClass.getName(), t
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 ) {
      LogFactory.getLog( BasicLazyInitializer.class ).error(
          "Javassist Enhancement failed: "
          + persistentClass.getName(), t
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

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.