Examples of createClass()


Examples of org.apache.tapestry5.ioc.services.ClassFab.createClass()

    {
        ClassFab cf = newClassFab("StringSubclass", String.class);

        try
        {
            cf.createClass();
        }
        catch (RuntimeException ex)
        {
            assertExceptionRegexp(ex, "Unable to create class StringSubclass\\: .*");
        }
View Full Code Here

Examples of org.apache.tapestry5.ioc.services.ClassFab.createClass()

    @Test
    public void create_class_within_non_default_package() throws Exception
    {
        ClassFab cf = newClassFab("org.apache.hivemind.InPackage", Object.class);

        Class c = cf.createClass();

        Object o = c.newInstance();

        assertEquals("org.apache.hivemind.InPackage", o.getClass().getName());
    }
View Full Code Here

Examples of org.apache.tapestry5.ioc.services.ClassFab.createClass()

        cf.addNoOpMethod(new MethodSignature(void.class, "run", null, null));
        cf.addNoOpMethod(new MethodSignature(int.class, "getInt", null, null));
        cf.addNoOpMethod(new MethodSignature(double.class, "getDouble", null, null));

        Class clazz = cf.createClass();

        Runnable instance = (Runnable) clazz.newInstance();

        instance.run();
View Full Code Here

Examples of org.apache.tapestry5.ioc.services.ClassFab.createClass()

        cf.proxyMethodsToDelegate(AnnotatedService.class, "_delegate", "Bla bla");
        cf.copyClassAnnotationsFromDelegate(AnnotatedServiceImpl.class);
        cf.copyMethodAnnotationsFromDelegate(AnnotatedService.class, AnnotatedServiceImpl.class);

        final Class targetClass = cf.createClass();

        final TestAnnotation a = (TestAnnotation) targetClass.getAnnotation(TestAnnotation.class);

        assertNotNull(a);
       
View Full Code Here

Examples of org.apache.tapestry5.ioc.services.ClassFab.createClass()

        MethodSignature getStringValue = new MethodSignature(String.class, "getStringValue", null, null);

        cf.addMethod(Modifier.PUBLIC, getStringValue, "return _stringValue;");

        Class targetClass = cf.createClass();

        Object targetBean = targetClass.newInstance();

        access.set(targetBean, "stringValue", "Fred");
View Full Code Here

Examples of org.apache.tapestry5.ioc.services.ClassFab.createClass()

    {
        ClassFab cf = newClassFab("ToString", Object.class);

        cf.addToString("ToString Description");

        Class clazz = cf.createClass();

        Object instance = clazz.newInstance();

        assertEquals(instance.toString(), "ToString Description");
    }
View Full Code Here

Examples of org.apache.tapestry5.ioc.services.ClassFab.createClass()

        cf.proxyMethodsToDelegate(SampleService.class, "_delegate", "<Delegator>");

        SampleService delegate = newMock(SampleService.class);

        Class clazz = cf.createClass();

        SampleService proxy = (SampleService) clazz.getConstructors()[0].newInstance(delegate);

        expect(delegate.primitiveMethod(5)).andReturn(10);
View Full Code Here

Examples of org.apache.tapestry5.ioc.services.ClassFab.createClass()

            {
                return "ACTUAL TO-STRING";
            }
        };

        Class clazz = cf.createClass();

        ToStringService proxy = (ToStringService) clazz.getConstructors()[0].newInstance(delegate);

        assertEquals(proxy.toString(), "ACTUAL TO-STRING");
    }
View Full Code Here

Examples of org.apache.tapestry5.ioc.services.ClassFab.createClass()

            classFab.copyClassAnnotationsFromDelegate(serviceImplementation);

            classFab.copyMethodAnnotationsFromDelegate(serviceInterface, serviceImplementation);
        }

        Class proxyClass = classFab.createClass();

        try
        {
            return proxyClass.getConstructors()[0].newInstance(creator, token);
        }
View Full Code Here

Examples of org.hibernate.repackage.cglib.proxy.Enhancer.createClass()

        en.setSuperclass( superClass );
      }
      if ( interfaces != null && interfaces.length > 0 ) {
        en.setInterfaces( interfaces );
      }
      proxyClass = en.createClass();
      try {
        factory = ( Factory ) proxyClass.newInstance();
      }
      catch ( Throwable t ) {
        throw new HibernateException( "Unable to build CGLIB Factory instance" );
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.