Package org.apache.cayenne

Examples of org.apache.cayenne.ValueHolder


    /**
     * Returns true if a property ValueHolder is not initialized or is itself a fault.
     */
    public boolean isFault(Object object) {
        ValueHolder holder = (ValueHolder) accessor.readPropertyDirectly(object);
        return holder == null || holder.isFault();
    }
View Full Code Here


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

    public Object readPropertyDirectly(Object object) throws PropertyAccessException {
        ValueHolder holder = (ValueHolder) accessor.readPropertyDirectly(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

    }

    public void writePropertyDirectly(Object object, Object oldValue, Object newValue)
            throws PropertyAccessException {

        ValueHolder holder = (ValueHolder) accessor.readPropertyDirectly(object);
        if (holder == null) {
            holder = createValueHolder(object);
            accessor.writePropertyDirectly(object, null, holder);
        }

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

     * injecting a ValueHolder if needed.
     */
    protected ValueHolder ensureValueHolderSet(Object object)
            throws PropertyAccessException {

        ValueHolder holder = (ValueHolder) accessor.readPropertyDirectly(object);
        if (holder == null) {
            holder = createValueHolder(object);
            accessor.writePropertyDirectly(object, null, holder);
        }

View Full Code Here

     */
    public void writePropertyDirectly(Object object, Object oldValue, Object newValue)
            throws PropertyAccessException {

        // must resolve value holder...
        ValueHolder holder = (ValueHolder) readProperty(object);
        holder.setValueDirectly(newValue);
    }
View Full Code Here

        }
    }

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

            // 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

    ValueHolder getWrappedValueHolder() {
        return (list instanceof ValueHolder) ? (ValueHolder) list : null;
    }

    public boolean isFault() {
        ValueHolder h = getWrappedValueHolder();
        return (h != null) ? h.isFault() : false;
    }
View Full Code Here

        ValueHolder h = getWrappedValueHolder();
        return (h != null) ? h.isFault() : false;
    }

    public Object setValueDirectly(Object value) throws CayenneRuntimeException {
        ValueHolder h = getWrappedValueHolder();
        return h != null ? h.setValueDirectly(value) : null;
    }
View Full Code Here

        ValueHolder h = getWrappedValueHolder();
        return h != null ? h.setValueDirectly(value) : null;
    }

    public Object setValue(Object value) throws CayenneRuntimeException {
        ValueHolder h = getWrappedValueHolder();
        return h != null ? h.setValue(value) : null;
    }
View Full Code Here

        ValueHolder h = getWrappedValueHolder();
        return h != null ? h.setValue(value) : null;
    }

    public Object getValue() throws CayenneRuntimeException {
        ValueHolder h = getWrappedValueHolder();
        return h != null ? h.getValue() : null;
    }
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.