org.knowm.xchange.huobi.dto.HuobiResult Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of xchange-huobi Show documentation
Show all versions of xchange-huobi Show documentation
XChange implementation for the Huobi Exchange
The newest version!
package org.knowm.xchange.huobi.dto;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
public class HuobiResult {
private final String status;
private final String errCode;
private final String errMsg;
private final V result;
@JsonCreator
public HuobiResult(
@JsonProperty("status") String status,
@JsonProperty("err-code") String errCode,
@JsonProperty("err-msg") String errMsg,
V result) {
this.status = status;
this.errCode = errCode;
this.errMsg = errMsg;
this.result = result;
}
public boolean isSuccess() {
return getStatus().equals("ok");
}
public String getStatus() {
return status;
}
public String getError() {
return (errMsg.length() == 0) ? errCode : errMsg;
}
public V getResult() {
return result;
}
@Override
public String toString() {
return String.format(
"HuobiResult [%s, %s]", status, isSuccess() ? getResult().toString() : getError());
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy