Examples of FieldAccessor


Examples of org.apache.cayenne.property.FieldAccessor

        if (dataObject) {
            return new DataObjectAccessor(propertyName);
        }

        try {
            return new FieldAccessor(objectClass, propertyName, propertyType);
        }
        catch (Throwable th) {

            throw new PropertyAccessException("Can't create accessor for property '"
                    + propertyName
View Full Code Here

Examples of org.apache.cayenne.reflect.FieldAccessor

    }

    public void testCopyObjectProperties() {
        PersistentDescriptor d1 = new PersistentDescriptor();

        FieldAccessor accessor = new FieldAccessor(TestBean.class, "string", String.class);
        Property property = new SimpleAttributeProperty(d1, accessor, null);

        d1.declaredProperties.put(property.getName(), property);

        TestBean from = new TestBean();
View Full Code Here

Examples of org.apache.cayenne.reflect.FieldAccessor

    static final String FAULT_FIELD_PREFIX = "$cay_faultResolved_";

    private Accessor faultResolvedFlagAccessor;

    EnhancedPojoPropertyFaultHandler(Class<?> objectClass, String propertyName) {
        this.faultResolvedFlagAccessor = new FieldAccessor(
                objectClass,
                FAULT_FIELD_PREFIX + propertyName,
                Boolean.TYPE);
    }
View Full Code Here

Examples of org.apache.cayenne.reflect.FieldAccessor

    static final String FAULT_FIELD_PREFIX = "$cay_faultResolved_";

    private Accessor faultResolvedFlagAccessor;

    EnhancedPojoPropertyFaultHandler(Class<?> objectClass, String propertyName) {
        this.faultResolvedFlagAccessor = new FieldAccessor(
                objectClass,
                FAULT_FIELD_PREFIX + propertyName,
                Boolean.TYPE);
    }
View Full Code Here

Examples of org.apache.cayenne.reflect.FieldAccessor

    static final String FAULT_FIELD_PREFIX = "$cay_faultResolved_";

    private Accessor faultResolvedFlagAccessor;

    EnhancedPojoPropertyFaultHandler(Class objectClass, String propertyName) {
        this.faultResolvedFlagAccessor = new FieldAccessor(
                objectClass,
                FAULT_FIELD_PREFIX + propertyName,
                Boolean.TYPE);
    }
View Full Code Here

Examples of org.apache.cayenne.reflect.FieldAccessor

import org.apache.cayenne.unit.util.TestBean;

public class FieldAccessorTest extends TestCase {

    public void testConstructor() {
        FieldAccessor accessor = new FieldAccessor(TestBean.class, "string", String.class);
        assertEquals("string", accessor.getName());
    }
View Full Code Here

Examples of org.apache.cayenne.reflect.FieldAccessor

        FieldAccessor accessor = new FieldAccessor(TestBean.class, "string", String.class);
        assertEquals("string", accessor.getName());
    }

    public void testGet() {
        FieldAccessor accessor = new FieldAccessor(TestBean.class, "string", String.class);

        TestBean object = new TestBean();
        object.setString("abc");
        assertEquals("abc", accessor.getValue(object));
    }
View Full Code Here

Examples of org.apache.cayenne.reflect.FieldAccessor

    public void testSetValue() {
        TestFields object = new TestFields();

        // string
        new FieldAccessor(TestFields.class, "stringField", String.class).setValue(
                object,
                "aaa");
        assertEquals("aaa", object.stringField);

        // primitive array
        byte[] bytes = new byte[] {
                1, 2, 3
        };
        new FieldAccessor(TestFields.class, "byteArrayField", byte[].class).setValue(
                object,
                bytes);
        assertSame(bytes, object.byteArrayField);

        // object array
        String[] strings = new String[] {
                "a", "b"
        };
        new FieldAccessor(TestFields.class, "stringArrayField", String[].class).setValue(
                object,
                strings);
        assertSame(strings, object.stringArrayField);
    }
View Full Code Here

Examples of org.apache.cayenne.reflect.FieldAccessor

    public void testSetValuePrimitive() {
        TestFields object = new TestFields();

        // primitive int .. write non-null
        new FieldAccessor(TestFields.class, "intField", Integer.TYPE).setValue(
                object,
                new Integer(6));
        assertEquals(6, object.intField);

        // primitive int .. write null
        object.intField = 55;
        new FieldAccessor(TestFields.class, "intField", Integer.TYPE).setValue(
                object,
                null);

        assertEquals(0, object.intField);
    }
View Full Code Here

Examples of org.fakereplace.reflection.FieldAccessor

        }
        int fieldNo = FieldReferenceDataStore.instance().getFieldNo(m.getName(), m.getDescriptor(), sig);
        String proxyName = ProxyDefinitionStore.getProxyName();
        ClassFile proxy = new ClassFile(false, proxyName, "java.lang.Object");
        ClassDataStore.instance().registerProxyName(oldClass, proxyName);
        FieldAccessor accessor = new FieldAccessor(oldClass, fieldNo);
        ClassDataStore.instance().registerFieldAccessor(proxyName, accessor);
        proxy.setAccessFlags(AccessFlag.PUBLIC);
        FieldInfo newField = new FieldInfo(proxy.getConstPool(), m.getName(), m.getDescriptor());
        newField.setAccessFlags(m.getAccessFlags());
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.