Search in sources :

Example 1 with AbstractHolderArgumentVisitor

use of org.eclipse.scout.rt.shared.servicetunnel.internal.AbstractHolderArgumentVisitor in project scout.rt by eclipse.

the class ServiceUtility method filterHolderArguments.

/**
 * Holders and nvpairs need to be copied as value clones. A smartfield for example is a holder and must not go to
 * backend. NVPairs with holder values ae replaced by NVPair with serializable holder arguments
 */
public Object[] filterHolderArguments(Object[] callerArgs) {
    Object[] serializableArgs = new Object[callerArgs.length];
    new AbstractHolderArgumentVisitor() {

        @SuppressWarnings("unchecked")
        @Override
        public void visitHolder(IHolder input, IHolder output) {
            if (!HolderUtility.containEqualValues(output, input)) {
                output.setValue(input.getValue());
            }
        }

        @Override
        public void visitOther(Object[] input, Object[] output, int index) {
            output[index] = input[index];
        }
    }.startVisiting(callerArgs, serializableArgs, 1, true);
    return serializableArgs;
}
Also used : AbstractHolderArgumentVisitor(org.eclipse.scout.rt.shared.servicetunnel.internal.AbstractHolderArgumentVisitor) IHolder(org.eclipse.scout.rt.platform.holders.IHolder)

Example 2 with AbstractHolderArgumentVisitor

use of org.eclipse.scout.rt.shared.servicetunnel.internal.AbstractHolderArgumentVisitor in project scout.rt by eclipse.

the class ServiceUtility method extractHolderArguments.

/**
 * Extract holders and nvpairs in callerArgs (and eventually in sub-arrays)
 */
public Object[] extractHolderArguments(Object[] callerArgs) {
    Object[] holderArgs = new Object[callerArgs.length];
    new AbstractHolderArgumentVisitor() {

        @Override
        public void visitHolder(IHolder input, IHolder output) {
        // do nothing
        }

        @Override
        public void visitOther(Object[] input, Object[] output, int index) {
        // do nothing
        }
    }.startVisiting(callerArgs, holderArgs, 1, true);
    return holderArgs;
}
Also used : AbstractHolderArgumentVisitor(org.eclipse.scout.rt.shared.servicetunnel.internal.AbstractHolderArgumentVisitor) IHolder(org.eclipse.scout.rt.platform.holders.IHolder)

Aggregations

IHolder (org.eclipse.scout.rt.platform.holders.IHolder)2 AbstractHolderArgumentVisitor (org.eclipse.scout.rt.shared.servicetunnel.internal.AbstractHolderArgumentVisitor)2