Package com.palantir.ptoss.cinch.core

Examples of com.palantir.ptoss.cinch.core.BindingContext


    public static String getString() {
        return "#" + i++;
    }

    public void testConstants() {
        BindingContext context = new BindingContext(this);
        assertEquals("string1", context.getBindableConstant("STRING_1"));
        assertEquals(Boolean.TRUE, context.getBindableConstant("BOOLEAN"));
        assertEquals("privateString", context.getBindableConstant("PRIVATE_STRING"));
        assertEquals("#0", context.getBindableConstant("FUNCTION_STRING"));

        assertEquals(null, context.getBindableConstant("NOT_FOUND"));
    }
View Full Code Here


    }

    private final SimpleModel model = new SimpleModel();

    public void testModel() {
        BindingContext context = new BindingContext(this);
        assertEquals(model, context.getBindableModel("model"));
    }
View Full Code Here

    public void testGetterIndex() throws IllegalArgumentException, IllegalAccessException, InvocationTargetException {
        model1.setSimpleString("string1");
        model2.setSimpleString("string2");
        model.setOtherString("other");
        BindingContext context = new BindingContext(this);
        assertNull(context.findGetter("simpleString"));
        ObjectFieldMethod ofm = context.findGetter("model1.simpleString");
        assertEquals("string1", ofm.getMethod().invoke(ofm.getObject(), (Object[])null));
        ofm = context.findGetter("model2.simpleString");
        assertEquals("string2", ofm.getMethod().invoke(ofm.getObject(), (Object[])null));
        ofm = context.findGetter("otherString");
        assertEquals("other", ofm.getMethod().invoke(ofm.getObject(), (Object[])null));
    }
View Full Code Here

        ofm = context.findGetter("otherString");
        assertEquals("other", ofm.getMethod().invoke(ofm.getObject(), (Object[])null));
    }

    public void testSetterIndex() throws IllegalArgumentException, IllegalAccessException, InvocationTargetException {
        BindingContext context = new BindingContext(this);
        assertNull(context.findSetter("simpleString"));
        ObjectFieldMethod ofm = context.findSetter("model1.simpleString");
        ofm.getMethod().invoke(ofm.getObject(), new Object[] { "set1" });
        assertEquals("set1", model1.getSimpleString());

        ofm = context.findSetter("model2.simpleString");
        ofm.getMethod().invoke(ofm.getObject(), new Object[] { "set2" });
        assertEquals("set2", model2.getSimpleString());

        ofm = context.findSetter("otherString");
        ofm.getMethod().invoke(ofm.getObject(), new Object[] { "setOther" });
        assertEquals("setOther", model.getOtherString());
    }
View Full Code Here

TOP

Related Classes of com.palantir.ptoss.cinch.core.BindingContext

Copyright © 2018 www.massapicom. 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.