Package javassist.util.proxy

Examples of javassist.util.proxy.ProxyObject


   /**
    * Wrap a Javassist interceptor around an instance of the component
    */
   public Object wrap(Object bean, MethodHandler interceptor) throws Exception
   {
      ProxyObject proxy = getProxyFactory().newInstance();
      proxy.setHandler(interceptor);
      return proxy;
   }
View Full Code Here


      proxyClass = factory.createClass();
    }

    public Object getProxy() {
      try {
        ProxyObject proxy = ( ProxyObject ) proxyClass.newInstance();
        proxy.setHandler( new PassThroughHandler( proxy, proxyClass.getName() ) );
        return proxy;
      }
      catch ( Throwable t ) {
        throw new HibernateException( "Unable to instantiated proxy instance" );
      }
View Full Code Here

      proxyClass = factory.createClass();
    }

    public Object getProxy() {
      try {
        ProxyObject proxy = ( ProxyObject ) proxyClass.newInstance();
        proxy.setHandler( new PassThroughHandler( proxy, proxyClass.getName() ) );
        return proxy;
      }
      catch ( Throwable t ) {
        throw new HibernateException( "Unable to instantiated proxy instance" );
      }
View Full Code Here

        });

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

            return newInstance;
        } catch (final InstantiationException e) {
            throw new IsisException(e);
        } catch (final IllegalAccessException e) {
View Full Code Here

        });

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

            return newInstance;
        } catch (final InstantiationException e) {
            throw new IsisException(e);
        } catch (final IllegalAccessException e) {
View Full Code Here

        @SuppressWarnings("unchecked")
        final Class<T> proxySubclass = proxyFactory.createClass();
        try {
            final T newInstance = proxySubclass.newInstance();
            final ProxyObject proxyObject = (ProxyObject) newInstance;
            proxyObject.setHandler(new MethodHandler() {
                private ThreadLocal<T> serviceByThread = new ThreadLocal<T>();
               
                @Override
                public Object invoke(final Object proxied, final Method proxyMethod, final Method proxiedMethod, final Object[] args) throws Throwable {
                    if(proxyMethod.getName().equals("__isis_startRequest")) {
View Full Code Here

        if (clazz.isInterface()) {
            return Util.createInstance(clazz, handler, WrapperObject.class);
        } else {
            final Class<T> enhancedClass = createEnhancedClass(clazz, handler, WrapperObject.class);
            ProxyObject proxyObject = (ProxyObject) Util.createInstance(enhancedClass);
            proxyObject.setHandler(new MethodHandler() {
                @Override
                public Object invoke(Object self, Method thisMethod, Method proceed, Object[] args) throws Throwable {
                    return handler.invoke(self, thisMethod, args);
                }
            });
View Full Code Here

    //    };


    private Object proxy(Class<?> proxyClass, final Invokable mockObject) {

        final ProxyObject proxyObject = (ProxyObject) objenesis.newInstance(proxyClass);
        proxyObject.setHandler(new MethodHandler() {
            @Override
            public Object invoke(Object self, Method thisMethod, Method proceed, Object[] args) throws Throwable {
                return mockObject.invoke(new Invocation(self, thisMethod, args));
            }
        });
View Full Code Here

        });

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

            return newInstance;
        } catch (final InstantiationException e) {
            throw new IsisException(e);
        } catch (final IllegalAccessException e) {
View Full Code Here

        @SuppressWarnings("unchecked")
        final Class<T> proxySubclass = proxyFactory.createClass();
        try {
            final T newInstance = proxySubclass.newInstance();
            final ProxyObject proxyObject = (ProxyObject) newInstance;
            proxyObject.setHandler(new MethodHandler() {
                private ThreadLocal<T> serviceByThread = new ThreadLocal<T>();
               
                @Override
                public Object invoke(final Object proxied, final Method proxyMethod, final Method proxiedMethod, final Object[] args) throws Throwable {
View Full Code Here

TOP

Related Classes of javassist.util.proxy.ProxyObject

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.