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

quark.PromiseValue Maven / Gradle / Ivy

There is a newer version: 2.0.37
Show newest version
/* Quark 1.0.452 run at 2016-11-11 16:09:46.008093 */
package quark;

/**
 * Snapshot of the value of a Promise, if it has one.
 */
public class PromiseValue implements io.datawire.quark.runtime.QObject {
    public static quark.reflect.Class quark_PromiseValue_ref = datawire_mdk_md.Root.quark_PromiseValue_md;
    public Object _successResult;
    public quark.error.Error _failureResult;
    public Boolean _hasValue;
    public PromiseValue(Object successResult, quark.error.Error failureResult, Boolean hasValue) {
        (this)._successResult = successResult;
        (this)._failureResult = failureResult;
        (this)._hasValue = hasValue;
    }
    /**
     * Return true if the Promise had a value at the time this was created.
     */
    public Boolean hasValue() {
        return (this)._hasValue;
    }
    /**
     * Return true if value is error. Result is only valid if hasValue() is true.
     */
    public Boolean isError() {
        return !(((this)._failureResult)==(null) || ((Object)((this)._failureResult) != null && ((Object) ((this)._failureResult)).equals(null)));
    }
    /**
     * Return the value. Result is only valid if hasValue() is true.
     */
    public Object getValue() {
        if ((this).isError()) {
            return (this)._failureResult;
        } else {
            return (this)._successResult;
        }
    }
    public String _getClass() {
        return "quark.PromiseValue";
    }
    public Object _getField(String name) {
        if ((name)==("_successResult") || ((Object)(name) != null && ((Object) (name)).equals("_successResult"))) {
            return (this)._successResult;
        }
        if ((name)==("_failureResult") || ((Object)(name) != null && ((Object) (name)).equals("_failureResult"))) {
            return (this)._failureResult;
        }
        if ((name)==("_hasValue") || ((Object)(name) != null && ((Object) (name)).equals("_hasValue"))) {
            return (this)._hasValue;
        }
        return null;
    }
    public void _setField(String name, Object value) {
        if ((name)==("_successResult") || ((Object)(name) != null && ((Object) (name)).equals("_successResult"))) {
            (this)._successResult = value;
        }
        if ((name)==("_failureResult") || ((Object)(name) != null && ((Object) (name)).equals("_failureResult"))) {
            (this)._failureResult = (quark.error.Error) (value);
        }
        if ((name)==("_hasValue") || ((Object)(name) != null && ((Object) (name)).equals("_hasValue"))) {
            (this)._hasValue = (Boolean) (value);
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy