Package org.apache.cayenne

Examples of org.apache.cayenne.ValueHolder


        ValueHolder holder = (ValueHolder) accessor.getValue(object);
        return holder == null || holder.isFault();
    }

    public void invalidate(Object object) {
        ValueHolder holder = (ValueHolder) accessor.getValue(object);
        if (holder != null && !holder.isFault()) {
            holder.invalidate();
        }
    }
View Full Code Here


        }
    }

    @Override
    public Object readPropertyDirectly(Object object) throws PropertyException {
        ValueHolder holder = (ValueHolder) accessor.getValue(object);

        // TODO: Andrus, 2/9/2006 ValueHolder will resolve an object in a call to
        // 'getValue'; this is inconsistent with 'readPropertyDirectly' contract
        return (holder != null) ? holder.getValueDirectly() : null;
    }
View Full Code Here

    @Override
    public void writePropertyDirectly(Object object, Object oldValue, Object newValue)
            throws PropertyException {

        ValueHolder holder = (ValueHolder) accessor.getValue(object);
        if (holder == null) {
            holder = createValueHolder(object);
            accessor.setValue(object, holder);
        }

        holder.setValueDirectly(newValue);
    }
View Full Code Here

     * Checks that an object's ValueHolder field described by this property is set,
     * injecting a ValueHolder if needed.
     */
    protected ValueHolder ensureValueHolderSet(Object object) throws PropertyException {

        ValueHolder holder = (ValueHolder) accessor.getValue(object);
        if (holder == null) {
            holder = createValueHolder(object);
            accessor.setValue(object, holder);
        }

View Full Code Here

            accessor.setValue(object, value);
        }
        else if (!(value instanceof ValueHolder)) {

            if (value instanceof Collection || value instanceof Map) {
                ValueHolder valueHolder = createCollectionValueHolder(object);
                valueHolder.setValueDirectly(value);

                accessor.setValue(object, valueHolder);
                value = valueHolder;
            }
        }
View Full Code Here

                || target instanceof Fault
                || ((ValueHolder) target).isFault();
    }

    public void invalidate(Object object) {
        ValueHolder list = (ValueHolder) readPropertyDirectly(object);
        if (list != null) {
            list.invalidate();
        }
    }
View Full Code Here

                || target instanceof Fault
                || ((ValueHolder) target).isFault();
    }

    public void invalidate(Object object) {
        ValueHolder list = (ValueHolder) readPropertyDirectly(object);
        if (list != null) {
            list.invalidate();
        }
    }
View Full Code Here

        }
    }

    private final void connect(Persistent object, List related) {
        if (incoming.getRelationship().isToMany()) {
            ValueHolder toManyList = (ValueHolder) incoming.readProperty(object);

            // TODO, Andrus 11/15/2005 - if list is modified, shouldn't we attempt to
            // merge the changes instead of overwriting?
            toManyList.setValueDirectly(related != null ? related : new ArrayList(1));
        }
        else {
            // this should've been handled elsewhere
            throw new CayenneRuntimeException(
                    "To-one relationship wasn't handled properly: " + incoming.getName());
View Full Code Here

            assertEquals(3, objects.size());

            Iterator it = objects.iterator();
            while (it.hasNext()) {
                Artist a = (Artist) it.next();
                ValueHolder list = (ValueHolder) a.getPaintingArray();

                assertNotNull(list);

                // intermediate relationship is not fetched...
                assertTrue(list.isFault());
            }

            // however both galleries must be in memory...
            g1 = (DataObject) context.getGraphManager().getNode(
                    new ObjectId("Gallery", Gallery.GALLERY_ID_PK_COLUMN, 33001));
View Full Code Here

        assertEquals(1, results.size());

        ClientMtTable2 result = (ClientMtTable2) results.get(0);

        ValueHolder holder = result.getTable1Direct();
        assertNotNull(holder);
        assertTrue(holder instanceof PersistentObjectHolder);
        PersistentObjectHolder objectHolder = (PersistentObjectHolder) holder;
        assertFalse(objectHolder.isFault());
View Full Code Here

TOP

Related Classes of org.apache.cayenne.ValueHolder

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.