Package org.apache.hivemind.service

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


        body.begin();
        body.addln("fred = $1;");
        body.addln("fred_0 = $2;");
        body.end();
       
        fab.addConstructor(aryEq(new Class[] { String.class, Map.class }), (Class[])isNull(),
                eq(body.toString()));
       
        replay();

        eo.finalizeEnhancedClass();
View Full Code Here


        body.addln("_serviceModel = $2;");
        body.addln("_deferredProxy._setInner(this);");

        body.end();

        classFab.addConstructor(new Class[]
        { deferredProxyClass, getClass() }, null, body.toString());

        // Method _service() will look up the service implementation,
        // then update the deferred proxy to go directly to the
        // service implementation, bypassing itself!
View Full Code Here

        Class serviceType = service.getClass();

        cf.addField("_service", serviceType);

        cf.addConstructor(new Class[]
        { serviceType }, null, "{ super(); _service = $1; }");

        builder.addServiceMethods("_service");

        return cf.createClass();
View Full Code Here

    public void testConstructor() throws Exception
    {
        ClassFab cf = newClassFab("ConstructableBean", Object.class);

        cf.addField("_stringValue", String.class);
        cf.addConstructor(new Class[]
        { String.class }, null, "{ _stringValue = $1; }");

        MethodSignature getStringValue = new MethodSignature(String.class, "getStringValue", null,
                null);
View Full Code Here

    public void testConstructorFromBaseClass() throws Exception
    {
        ClassFab cf = newClassFab("MyIntHolder", AbstractIntWrapper.class);

        cf.addField("_intValue", int.class);
        cf.addConstructor(new Class[]
        { int.class }, null, "{ _intValue = $1; }");

        cf.addMethod(
                Modifier.PUBLIC,
                new MethodSignature(int.class, "getIntValue", null, null),
View Full Code Here

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

        try
        {
            cf.addConstructor(null, null, " woops!");
        }
        catch (ApplicationRuntimeException ex)
        {
            assertExceptionSubstring(ex, "Unable to add constructor to class BadConstructor");
        }
View Full Code Here

        cf.addInterface(Runnable.class);
        cf.addInterface(Serializable.class);

        cf.addField("_map", Map.class);

        cf.addConstructor(new Class[]
        { Map.class, Runnable.class }, new Class[]
        { IllegalArgumentException.class, DataFormatException.class }, "{ _map = $1; }");

        MethodSignature sig = new MethodSignature(Map.class, "doTheNasty", new Class[]
        { int.class, String.class }, new Class[]
View Full Code Here

        body.begin();
        body.addln("fred = $1;");
        body.addln("fred_0 = $2;");
        body.end();

        fab.addConstructor(new Class[]
        { String.class, Map.class }, null, body.toString());
        fabc.setMatcher(new ArrayMatcher());

        replayControls();
View Full Code Here

            }

            classFab.addMethod(Modifier.PUBLIC, valueGetter, generateOgnlGetter(classFab, valueGetter));
            classFab.addMethod(Modifier.PUBLIC, valueSetter, generateOgnlSetter(classFab, valueSetter));

            classFab.addConstructor(new Class[0], new Class[0], "{}");

            Class clazz = ((AbstractFab) classFab).createClass(true);

            expression.setAccessor((ExpressionAccessor) clazz.newInstance());
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.