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

com.xeiam.xchange.kraken.dto.KrakenResult Maven / Gradle / Ivy

There is a newer version: 3.1.0
Show newest version
package com.xeiam.xchange.kraken.dto;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;

/**
 * @author Raphael Voellmy
 */
public class KrakenResult {

  private final V result;
  private final String[] error;

  /**
   * Constructor
   * 
   * @param result
   * @param error
   */
  @JsonCreator
  public KrakenResult(@JsonProperty("return") V result, @JsonProperty("error") String[] error) {

    this.result = result;
    this.error = error;
  }

  public boolean isSuccess() {

    return error.length == 0;
  }

  public V getResult() {

    return result;
  }

  public String[] getError() {

    return error;
  }

  @Override
  public String toString() {

    return String.format("KrakenResult[%s: %s]", isSuccess() ? "OK" : "error", isSuccess() ? result.toString() : error);
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy