Search in sources :

Example 6 with ProxyObject

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

the class GenericExporterFacadeTest method setUp.

@Before
public void setUp() throws Exception {
    ProxyFactory proxyFactory = new ProxyFactory();
    proxyFactory.setSuperclass(GenericExporter.class);
    Class<?> proxyClass = proxyFactory.createClass();
    genericExporter = (GenericExporter) proxyClass.newInstance();
    ((ProxyObject) genericExporter).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);
        }
    });
    genericExporterFacade = new AbstractGenericExporterFacade(FACADE_FACTORY, genericExporter) {
    };
    reset();
}
Also used : ProxyObject(javassist.util.proxy.ProxyObject) MethodHandler(javassist.util.proxy.MethodHandler) ProxyFactory(javassist.util.proxy.ProxyFactory) ProxyObject(javassist.util.proxy.ProxyObject) Method(java.lang.reflect.Method) AbstractGenericExporterFacade(org.jboss.tools.hibernate.runtime.common.AbstractGenericExporterFacade) Before(org.junit.Before)

Example 7 with ProxyObject

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

the class ForeignKeyFacadeTest method setUp.

@Before
public void setUp() throws Exception {
    ProxyFactory proxyFactory = new ProxyFactory();
    proxyFactory.setSuperclass(ForeignKey.class);
    Class<?> proxyClass = proxyFactory.createClass();
    foreignKey = (ForeignKey) proxyClass.newInstance();
    ((ProxyObject) foreignKey).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);
        }
    });
    foreignKeyFacade = new AbstractForeignKeyFacade(FACADE_FACTORY, foreignKey) {
    };
    reset();
}
Also used : ProxyObject(javassist.util.proxy.ProxyObject) MethodHandler(javassist.util.proxy.MethodHandler) ProxyFactory(javassist.util.proxy.ProxyFactory) AbstractForeignKeyFacade(org.jboss.tools.hibernate.runtime.common.AbstractForeignKeyFacade) ProxyObject(javassist.util.proxy.ProxyObject) Method(java.lang.reflect.Method) Before(org.junit.Before)

Example 8 with ProxyObject

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

the class GenericExporterFacadeTest method setUp.

@Before
public void setUp() throws Exception {
    ProxyFactory proxyFactory = new ProxyFactory();
    proxyFactory.setSuperclass(GenericExporter.class);
    Class<?> proxyClass = proxyFactory.createClass();
    genericExporter = (GenericExporter) proxyClass.newInstance();
    ((ProxyObject) genericExporter).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);
        }
    });
    genericExporterFacade = new AbstractGenericExporterFacade(FACADE_FACTORY, genericExporter) {
    };
    reset();
}
Also used : ProxyObject(javassist.util.proxy.ProxyObject) MethodHandler(javassist.util.proxy.MethodHandler) ProxyFactory(javassist.util.proxy.ProxyFactory) ProxyObject(javassist.util.proxy.ProxyObject) Method(java.lang.reflect.Method) AbstractGenericExporterFacade(org.jboss.tools.hibernate.runtime.common.AbstractGenericExporterFacade) Before(org.junit.Before)

Example 9 with ProxyObject

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

the class ForeignKeyFacadeTest method setUp.

@Before
public void setUp() throws Exception {
    ProxyFactory proxyFactory = new ProxyFactory();
    proxyFactory.setSuperclass(ForeignKey.class);
    Class<?> proxyClass = proxyFactory.createClass();
    foreignKey = (ForeignKey) proxyClass.newInstance();
    ((ProxyObject) foreignKey).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);
        }
    });
    foreignKeyFacade = new AbstractForeignKeyFacade(FACADE_FACTORY, foreignKey) {
    };
    reset();
}
Also used : ProxyObject(javassist.util.proxy.ProxyObject) MethodHandler(javassist.util.proxy.MethodHandler) ProxyFactory(javassist.util.proxy.ProxyFactory) AbstractForeignKeyFacade(org.jboss.tools.hibernate.runtime.common.AbstractForeignKeyFacade) ProxyObject(javassist.util.proxy.ProxyObject) Method(java.lang.reflect.Method) Before(org.junit.Before)

Example 10 with ProxyObject

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

the class GenericExporterFacadeTest method setUp.

@Before
public void setUp() throws Exception {
    ProxyFactory proxyFactory = new ProxyFactory();
    proxyFactory.setSuperclass(GenericExporter.class);
    Class<?> proxyClass = proxyFactory.createClass();
    genericExporter = (GenericExporter) proxyClass.newInstance();
    ((ProxyObject) genericExporter).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);
        }
    });
    genericExporterFacade = new AbstractGenericExporterFacade(FACADE_FACTORY, genericExporter) {
    };
    reset();
}
Also used : ProxyObject(javassist.util.proxy.ProxyObject) MethodHandler(javassist.util.proxy.MethodHandler) ProxyFactory(javassist.util.proxy.ProxyFactory) ProxyObject(javassist.util.proxy.ProxyObject) Method(java.lang.reflect.Method) AbstractGenericExporterFacade(org.jboss.tools.hibernate.runtime.common.AbstractGenericExporterFacade) Before(org.junit.Before)

Aggregations

ProxyObject (javassist.util.proxy.ProxyObject)30 MethodHandler (javassist.util.proxy.MethodHandler)26 ProxyFactory (javassist.util.proxy.ProxyFactory)26 Method (java.lang.reflect.Method)25 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 ODatabaseObject (com.orientechnologies.orient.core.db.object.ODatabaseObject)2 ORID (com.orientechnologies.orient.core.id.ORID)2 ORecord (com.orientechnologies.orient.core.record.ORecord)2 OObjectProxyMethodHandler (com.orientechnologies.orient.object.enhancement.OObjectProxyMethodHandler)2 Proxy (javassist.util.proxy.Proxy)2 ODatabaseDocument (com.orientechnologies.orient.core.db.document.ODatabaseDocument)1 OObjectLazyMultivalueElement (com.orientechnologies.orient.core.db.object.OObjectLazyMultivalueElement)1 OIdentifiable (com.orientechnologies.orient.core.db.record.OIdentifiable)1 OSerializationException (com.orientechnologies.orient.core.exception.OSerializationException)1