Search in sources :

Example 21 with MethodHandler

use of javassist.util.proxy.MethodHandler in project jbosstools-hibernate by jbosstools.

the class ArtifactCollectorFacadeTest method setUp.

@Before
public void setUp() throws Exception {
    ProxyFactory proxyFactory = new ProxyFactory();
    proxyFactory.setSuperclass(ArtifactCollector.class);
    Class<?> proxyClass = proxyFactory.createClass();
    ProxyObject proxy = (ProxyObject) proxyClass.newInstance();
    proxy.setHandler(new MethodHandler() {

        @Override
        public Object invoke(Object self, Method m, Method proceed, Object[] args) throws Throwable {
            if (methodName == null) {
                methodName = m.getName();
            }
            if (arguments == null) {
                arguments = args;
            }
            return proceed.invoke(self, args);
        }
    });
    artifactCollector = new AbstractArtifactCollectorFacade(FACADE_FACTORY, (ArtifactCollector) proxy) {
    };
    reset();
}
Also used : ProxyObject(javassist.util.proxy.ProxyObject) MethodHandler(javassist.util.proxy.MethodHandler) AbstractArtifactCollectorFacade(org.jboss.tools.hibernate.runtime.common.AbstractArtifactCollectorFacade) ProxyFactory(javassist.util.proxy.ProxyFactory) ArtifactCollector(org.hibernate.tool.hbm2x.ArtifactCollector) IArtifactCollector(org.jboss.tools.hibernate.runtime.spi.IArtifactCollector) ProxyObject(javassist.util.proxy.ProxyObject) Method(java.lang.reflect.Method) Before(org.junit.Before)

Example 22 with MethodHandler

use of javassist.util.proxy.MethodHandler in project jbosstools-hibernate by jbosstools.

the class Hbm2DDLExporterFacadeTest method setUp.

@Before
public void setUp() throws Exception {
    ProxyFactory proxyFactory = new ProxyFactory();
    proxyFactory.setSuperclass(Hbm2DDLExporter.class);
    Class<?> proxyClass = proxyFactory.createClass();
    hbm2ddlExporter = (Hbm2DDLExporter) proxyClass.newInstance();
    ((ProxyObject) hbm2ddlExporter).setHandler(new MethodHandler() {

        @Override
        public Object invoke(Object self, Method m, Method proceed, Object[] args) throws Throwable {
            if (methodName == null) {
                methodName = m.getName();
            }
            if (arguments == null) {
                arguments = args;
            }
            return proceed.invoke(self, args);
        }
    });
    hbm2DDLExporterFacade = new AbstractHbm2DDLExporterFacade(FACADE_FACTORY, hbm2ddlExporter) {
    };
    reset();
}
Also used : ProxyObject(javassist.util.proxy.ProxyObject) AbstractHbm2DDLExporterFacade(org.jboss.tools.hibernate.runtime.common.AbstractHbm2DDLExporterFacade) MethodHandler(javassist.util.proxy.MethodHandler) ProxyFactory(javassist.util.proxy.ProxyFactory) ProxyObject(javassist.util.proxy.ProxyObject) Method(java.lang.reflect.Method) Before(org.junit.Before)

Example 23 with MethodHandler

use of javassist.util.proxy.MethodHandler in project jbosstools-hibernate by jbosstools.

the class ArtifactCollectorFacadeTest method setUp.

@Before
public void setUp() throws Exception {
    ProxyFactory proxyFactory = new ProxyFactory();
    proxyFactory.setSuperclass(ArtifactCollector.class);
    Class<?> proxyClass = proxyFactory.createClass();
    ProxyObject proxy = (ProxyObject) proxyClass.newInstance();
    proxy.setHandler(new MethodHandler() {

        @Override
        public Object invoke(Object self, Method m, Method proceed, Object[] args) throws Throwable {
            if (methodName == null) {
                methodName = m.getName();
            }
            if (arguments == null) {
                arguments = args;
            }
            return proceed.invoke(self, args);
        }
    });
    artifactCollector = new AbstractArtifactCollectorFacade(FACADE_FACTORY, (ArtifactCollector) proxy) {
    };
    reset();
}
Also used : ProxyObject(javassist.util.proxy.ProxyObject) MethodHandler(javassist.util.proxy.MethodHandler) AbstractArtifactCollectorFacade(org.jboss.tools.hibernate.runtime.common.AbstractArtifactCollectorFacade) ProxyFactory(javassist.util.proxy.ProxyFactory) ArtifactCollector(org.hibernate.tool.hbm2x.ArtifactCollector) IArtifactCollector(org.jboss.tools.hibernate.runtime.spi.IArtifactCollector) ProxyObject(javassist.util.proxy.ProxyObject) Method(java.lang.reflect.Method) Before(org.junit.Before)

Example 24 with MethodHandler

use of javassist.util.proxy.MethodHandler in project jbosstools-hibernate by jbosstools.

the class ArtifactCollectorFacadeTest method setUp.

@Before
public void setUp() throws Exception {
    ProxyFactory proxyFactory = new ProxyFactory();
    proxyFactory.setSuperclass(ArtifactCollector.class);
    Class<?> proxyClass = proxyFactory.createClass();
    ProxyObject proxy = (ProxyObject) proxyClass.newInstance();
    proxy.setHandler(new MethodHandler() {

        @Override
        public Object invoke(Object self, Method m, Method proceed, Object[] args) throws Throwable {
            if (methodName == null) {
                methodName = m.getName();
            }
            if (arguments == null) {
                arguments = args;
            }
            return proceed.invoke(self, args);
        }
    });
    artifactCollector = new AbstractArtifactCollectorFacade(FACADE_FACTORY, (ArtifactCollector) proxy) {
    };
    reset();
}
Also used : ProxyObject(javassist.util.proxy.ProxyObject) MethodHandler(javassist.util.proxy.MethodHandler) AbstractArtifactCollectorFacade(org.jboss.tools.hibernate.runtime.common.AbstractArtifactCollectorFacade) ProxyFactory(javassist.util.proxy.ProxyFactory) ArtifactCollector(org.hibernate.tool.hbm2x.ArtifactCollector) IArtifactCollector(org.jboss.tools.hibernate.runtime.spi.IArtifactCollector) ProxyObject(javassist.util.proxy.ProxyObject) Method(java.lang.reflect.Method) Before(org.junit.Before)

Example 25 with MethodHandler

use of javassist.util.proxy.MethodHandler in project jbosstools-hibernate by jbosstools.

the class ArtifactCollectorFacadeTest method setUp.

@Before
public void setUp() throws Exception {
    ProxyFactory proxyFactory = new ProxyFactory();
    proxyFactory.setSuperclass(ArtifactCollector.class);
    Class<?> proxyClass = proxyFactory.createClass();
    ProxyObject proxy = (ProxyObject) proxyClass.newInstance();
    proxy.setHandler(new MethodHandler() {

        @Override
        public Object invoke(Object self, Method m, Method proceed, Object[] args) throws Throwable {
            if (methodName == null) {
                methodName = m.getName();
            }
            if (arguments == null) {
                arguments = args;
            }
            return proceed.invoke(self, args);
        }
    });
    artifactCollector = new AbstractArtifactCollectorFacade(FACADE_FACTORY, (ArtifactCollector) proxy) {
    };
    reset();
}
Also used : ProxyObject(javassist.util.proxy.ProxyObject) MethodHandler(javassist.util.proxy.MethodHandler) AbstractArtifactCollectorFacade(org.jboss.tools.hibernate.runtime.common.AbstractArtifactCollectorFacade) ProxyFactory(javassist.util.proxy.ProxyFactory) ArtifactCollector(org.hibernate.tool.hbm2x.ArtifactCollector) IArtifactCollector(org.jboss.tools.hibernate.runtime.spi.IArtifactCollector) ProxyObject(javassist.util.proxy.ProxyObject) Method(java.lang.reflect.Method) Before(org.junit.Before)

Aggregations

MethodHandler (javassist.util.proxy.MethodHandler)33 ProxyFactory (javassist.util.proxy.ProxyFactory)32 Method (java.lang.reflect.Method)31 ProxyObject (javassist.util.proxy.ProxyObject)26 Before (org.junit.Before)24 ArtifactCollector (org.hibernate.tool.hbm2x.ArtifactCollector)6 AbstractArtifactCollectorFacade (org.jboss.tools.hibernate.runtime.common.AbstractArtifactCollectorFacade)6 AbstractForeignKeyFacade (org.jboss.tools.hibernate.runtime.common.AbstractForeignKeyFacade)6 AbstractGenericExporterFacade (org.jboss.tools.hibernate.runtime.common.AbstractGenericExporterFacade)6 AbstractHbm2DDLExporterFacade (org.jboss.tools.hibernate.runtime.common.AbstractHbm2DDLExporterFacade)6 IArtifactCollector (org.jboss.tools.hibernate.runtime.spi.IArtifactCollector)6 MethodFilter (javassist.util.proxy.MethodFilter)4 Proxy (javassist.util.proxy.Proxy)3 InvocationTargetException (java.lang.reflect.InvocationTargetException)2 ODatabaseObject (com.orientechnologies.orient.core.db.object.ODatabaseObject)1 OSerializationException (com.orientechnologies.orient.core.exception.OSerializationException)1 Element (com.tinkerpop.blueprints.Element)1 IOException (java.io.IOException)1 Proxy (java.lang.reflect.Proxy)1 URLClassLoader (java.net.URLClassLoader)1