Examples of createClass()


Examples of org.apache.hivemind.service.ClassFab.createClass()

        cf.addMethod(
            Modifier.PUBLIC,
            new MethodSignature(int.class, "getIntValue", null, null),
            "return _intValue;");

        Class targetClass = cf.createClass();
        Constructor c = targetClass.getConstructors()[0];

        AbstractIntWrapper targetBean =
            (AbstractIntWrapper) c.newInstance(new Object[] { new Integer(137)});
View Full Code Here

Examples of org.apache.hivemind.service.ClassFab.createClass()

    {
        ClassFab cf = newClassFab("InvalidSuperClass", List.class);

        try
        {
            cf.createClass();
            unreachable();
        }
        catch (ApplicationRuntimeException ex)
        {
            assertExceptionSubstring(ex, "Unable to create class InvalidSuperClass");
View Full Code Here

Examples of org.apache.hivemind.service.ClassFab.createClass()

        cf.addMethod(
            Modifier.PUBLIC,
            new MethodSignature(int.class, "add", new Class[] { int.class, int.class }, null),
            "return $1 + $2;");

        Class targetClass = cf.createClass();

        SimpleService s = (SimpleService) targetClass.newInstance();

        assertEquals(207, s.add(99, 108));
    }
View Full Code Here

Examples of org.apache.hivemind.service.ClassFab.createClass()

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

        try
        {
            cf.createClass();
        }
        catch (ApplicationRuntimeException ex)
        {
            assertEquals(
                "Unable to create class StringSubclass: Cannot inherit from final class",
View Full Code Here

Examples of org.apache.hivemind.service.ClassFab.createClass()

    public void testInPackage() 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.hivemind.service.ClassFab.createClass()

                new MethodSignature(int.class, "getValue", null, null),
                "return 1;");

        mf.extend("return 2 * $_;", false);

        Object bean = cf.createClass().newInstance();

        assertEquals(new Integer(2), PropertyUtils.read(bean, "value"));
    }

    public void testExtendMethodAlterReturn() throws Exception
View Full Code Here

Examples of org.apache.hivemind.service.ClassFab.createClass()

                new MethodSignature(int.class, "getValue", null, null),
                "return 2;");

        mf.extend("$_ = 3 * $_;", false);

        Object bean = cf.createClass().newInstance();

        assertEquals(new Integer(6), PropertyUtils.read(bean, "value"));
    }

    public void testExtendMethodFailure() throws Exception
View Full Code Here

Examples of org.apache.hivemind.service.ClassFab.createClass()

                new MethodSignature(void.class, "fail", null, null),
                "throw new java.lang.RuntimeException(\"Ouch!\");");

        mf.addCatch(RuntimeException.class, "throw new java.io.IOException($e.getMessage());");

        Class targetClass = cf.createClass();

        FailService fs = (FailService) targetClass.newInstance();

        try
        {
View Full Code Here

Examples of org.apache.hivemind.service.ClassFab.createClass()

        cf.addField("buffy", int.class);
        cf.addField("", int.class);

        try
        {
            cf.createClass();
            unreachable();
        }
        catch (ApplicationRuntimeException ex)
        {
            assertExceptionSubstring(ex, "Unable to create class InvalidField");
View Full Code Here

Examples of org.apache.hivemind.service.ClassFab.createClass()

        createInfrastructure(stack, classFab);

        addServiceMethods(stack, classFab, parameters);

        return classFab.createClass();
    }

    private void createInfrastructure(InterceptorStack stack, ClassFab classFab)
    {
        Class topClass = stack.peek().getClass();
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.