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

net.intelie.liverig.witsml.WITSMLResult Maven / Gradle / Ivy

The newest version!
package net.intelie.liverig.witsml;

import com.google.common.base.Preconditions;
import net.intelie.liverig.witsml.objects.RawData;

import java.util.Objects;

public class WITSMLResult {
    public static final short SUCCESS = 1;
    public static final short TRUNCATED = 2;

    private final short result;
    private final String xml;

    public WITSMLResult(short result, String xml) {
        Preconditions.checkArgument(result >= 0, "Use WITSMLException for failure results");
        this.result = result;
        this.xml = xml;
    }

    public WITSMLResult(String xml) {
        this(SUCCESS, xml);
    }

    public short getResult() {
        return result;
    }

    public String getXml() {
        return xml;
    }

    public RawData toRawData() {
        return new RawData(result, xml);
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        WITSMLResult that = (WITSMLResult) o;
        return result == that.result &&
                Objects.equals(xml, that.xml);
    }

    @Override
    public int hashCode() {
        return Objects.hash(result, xml);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy