All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.nakedobjects.nos.remote.command.java.JavaResult Maven / Gradle / Ivy

There is a newer version: 3.0.3
Show newest version
package org.nakedobjects.nos.remote.command.java;

import java.io.Serializable;

import org.nakedobjects.noa.util.ByteDecoder;
import org.nakedobjects.noa.util.ByteEncoder;
import org.nakedobjects.noa.util.Encodable;
import org.nakedobjects.nof.reflect.remote.data.Data;
import org.nakedobjects.nof.reflect.remote.data.ObjectData;
import org.nakedobjects.nof.reflect.remote.data.ReferenceData;
import org.nakedobjects.nof.reflect.remote.data.ServerActionResultData;


public class JavaResult implements ServerActionResultData, Encodable, Serializable {
    private static final long serialVersionUID = 1L;
    private final Data result;
    private final ObjectData[] updatesData;
    private final ObjectData persistedTarget;
    private final ObjectData[] persistedParameters;
    private String[] warnings;
    private String[] messages;
    private final ReferenceData[] disposed;

    public JavaResult(
            final Data result,
            final ObjectData[] updatesData,
            final ReferenceData[] disposed,
            final ObjectData persistedTarget,
            final ObjectData[] persistedParameters,
            final String[] messages,
            final String[] warnings) {
        this.result = result;
        this.updatesData = updatesData;
        this.disposed = disposed;
        this.persistedTarget = persistedTarget;
        this.persistedParameters = persistedParameters;
        this.messages = messages;
        this.warnings = warnings;
    }

    public JavaResult(final ByteDecoder decoder) {
        result = (Data) decoder.getObject();
        messages = decoder.getList();
        warnings = decoder.getList();
        updatesData = (ObjectData[]) decoder.getObjects();
        disposed = (ReferenceData[]) decoder.getObjects();
        persistedTarget = (ObjectData) decoder.getObject();
        persistedParameters = (ObjectData[]) decoder.getObjects();
    }
    
    public void encode(final ByteEncoder encoder) {        
        encoder.add(result);
        encoder.add(messages);
        encoder.add(warnings);
        encoder.add(updatesData);
        encoder.add(disposed);
        encoder.add(persistedTarget);
        encoder.add(persistedParameters);
    }

    public Data getReturn() {
        return result;
    }

    public ObjectData getPersistedTarget() {
        return persistedTarget;
    }

    public ObjectData[] getPersistedParameters() {
        return persistedParameters;
    }

    public ObjectData[] getUpdates() {
        return updatesData;
    }
    
    public ReferenceData[] getDisposed() {
        return disposed;
    }

    public String[] getMessages() {
        return messages;
    }

    public String[] getWarnings() {
        return warnings;
    }

}
// Copyright (c) Naked Objects Group Ltd.




© 2015 - 2025 Weber Informatics LLC | Privacy Policy