Package org.apache.tapestry5.ioc.services

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


        cf.addConstructor(constructorParameterTypes, null, constructor.toString());

        cf.addMethod(Modifier.PUBLIC, NEW_INSTANCE_SIGNATURE, newInstance.toString());

        Class instantiatorClass = cf.createClass();

        try
        {
            Object instance = instantiatorClass.getConstructors()[0].newInstance(constructorParameterValues);
View Full Code Here


        cf.addConstructor(constructorParameterTypes, null, constructor.toString());

        cf.addMethod(Modifier.PUBLIC, NEW_INSTANCE_SIGNATURE, newInstance.toString());

        Class instantiatorClass = cf.createClass();

        try
        {
            Object instance = instantiatorClass.getConstructors()[0].newInstance(constructorParameterValues);
View Full Code Here

        ClassFab cf = factory.newClass(clazz.getName() + "$$Proxy", clazz);

        cf.addInterface(Serializable.class);

        Class proxyClass = cf.createClass();

        SimpleBean simple = (SimpleBean) proxyClass.newInstance();

        assertTrue(simple instanceof Serializable);
View Full Code Here

        MethodSignature signature = new MethodSignature(List.class.getMethod("size"));

        fab.addMethod(modifiers, signature, "return 0;");

        Class moduleClass = fab.createClass();

        // make sure we really managed to create a synthetic method

        assertTrue(moduleClass.getMethod("size").isSynthetic());
View Full Code Here

            classFab.copyClassAnnotationsFromDelegate(serviceImplementation);

            classFab.copyMethodAnnotationsFromDelegate(serviceInterface, serviceImplementation);
        }

        Class proxyClass = classFab.createClass();

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

        }

        if (!mi.getToString())
            classFab.addMethod(Modifier.PUBLIC, toStringSignature, String.format("return %s;", DESCRIPTION_FIELD));

        return classFab.createClass();
    }
}
View Full Code Here

            classFab.copyClassAnnotationsFromDelegate(delegateClass);
           
            classFab.copyMethodAnnotationsFromDelegate(proxyInterface, (Class)delegateClass);
        }
       
        Class proxyClass = classFab.createClass();

        try
        {
            Object proxy = proxyClass.getConstructors()[0].newInstance(delegateCreator);
View Full Code Here

        MethodSignature signature = new MethodSignature(List.class.getMethod("size"));

        fab.addMethod(modifiers, signature, "return 0;");

        Class moduleClass = fab.createClass();

        // make sure we really managed to create a synthetic method

        assertTrue(moduleClass.getMethod("size").isSynthetic());
       
View Full Code Here

        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

    {
        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

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.