|
| 1 | +/* |
| 2 | + * Copyright (c) 2019 BitPay |
| 3 | + */ |
1 | 4 | package com.bitpay.sdk.model.Rate;
|
2 | 5 |
|
3 | 6 | import com.fasterxml.jackson.annotation.JsonIgnore;
|
4 | 7 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
5 | 8 | import com.fasterxml.jackson.annotation.JsonProperty;
|
6 | 9 |
|
| 10 | +/** |
| 11 | + * <p> |
| 12 | + * Rate is a class that represents a currency name, currency code, and value, |
| 13 | + * and is used to create an object that is used when fetching exchange rates |
| 14 | + * from the API. |
| 15 | + * </p> |
| 16 | + * <p> |
| 17 | + * Here's an example of the JSON object that's created: |
| 18 | + * </p> |
| 19 | + * <pre> |
| 20 | + * { |
| 21 | + * "code": "BTC", |
| 22 | + * "name": "Bitcoin", |
| 23 | + * "rate": 1 |
| 24 | + * } |
| 25 | + * </pre> |
| 26 | + * |
| 27 | + * @see com.bitpay.sdk.Client#getRates() |
| 28 | + * @see com.bitpay.sdk.model.Rate.Rates |
| 29 | + */ |
7 | 30 | @JsonIgnoreProperties(ignoreUnknown = true)
|
8 | 31 | public class Rate {
|
9 | 32 |
|
10 |
| - private String _name; |
| 33 | + /** |
| 34 | + * An ISO 4217 currency code or cryptocurrency code |
| 35 | + * |
| 36 | + * Refer to <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO Standards</a> |
| 37 | + * for a list of ISO 4217 currency codes. |
| 38 | + * |
| 39 | + */ |
11 | 40 | private String _code;
|
| 41 | + |
| 42 | + /** |
| 43 | + * The name of the currency or cryptocurrency |
| 44 | + * |
| 45 | + * Refer to <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO Standards</a> |
| 46 | + * for a list of ISO 4217 currency codes. |
| 47 | + */ |
| 48 | + private String _name; |
| 49 | + |
| 50 | + /** |
| 51 | + * The value of the rate, returned in the JSON as "rate" and to a precision |
| 52 | + * of two decimal places. |
| 53 | + */ |
12 | 54 | private Double _value;
|
13 | 55 |
|
| 56 | + /** |
| 57 | + * Class constructor. |
| 58 | + */ |
14 | 59 | public Rate() {
|
15 | 60 | }
|
16 | 61 |
|
| 62 | + /** |
| 63 | + * Returns the name of the rate's currency or cryptocurrency. |
| 64 | + * |
| 65 | + * @return the name of the rate's currency or cryptocurrency |
| 66 | + */ |
17 | 67 | @JsonIgnore
|
18 | 68 | public String getName() {
|
19 | 69 | return _name;
|
20 | 70 | }
|
21 | 71 |
|
| 72 | + /** |
| 73 | + * Sets the name of the rate's currency or cryptocurrency. |
| 74 | + * |
| 75 | + * @param name the name of the rate |
| 76 | + */ |
22 | 77 | @JsonProperty("name")
|
23 | 78 | public void setName(String name) {
|
24 | 79 | this._name = name;
|
25 | 80 | }
|
26 | 81 |
|
| 82 | + /** |
| 83 | + * Returns the rate's ISO 4217 currency code or cryptocurrency code. |
| 84 | + * |
| 85 | + * @return the rate's ISO 4217 currency code or cryptocurrency code |
| 86 | + */ |
27 | 87 | @JsonIgnore
|
28 | 88 | public String getCode() {
|
29 | 89 | return _code;
|
30 | 90 | }
|
31 | 91 |
|
| 92 | + /** |
| 93 | + * Sets the rate's ISO 4217 currency code or cryptocurrency code. |
| 94 | + * |
| 95 | + * @param code the rate's ISO 4217 currency code or cryptocurrency code |
| 96 | + */ |
32 | 97 | @JsonProperty("code")
|
33 | 98 | public void setCode(String code) {
|
34 | 99 | this._code = code;
|
35 | 100 | }
|
36 | 101 |
|
| 102 | + /** |
| 103 | + * Returns the numeric value of the rate. |
| 104 | + * |
| 105 | + * @return the numeric value of the rate, to two decimal places |
| 106 | + */ |
37 | 107 | @JsonIgnore
|
38 | 108 | public Double getValue() {
|
39 | 109 | return _value;
|
40 | 110 | }
|
41 | 111 |
|
| 112 | + /** |
| 113 | + * Sets the numeric value of the rate. |
| 114 | + * |
| 115 | + * @param value the numeric value of the rate, to two decimal places |
| 116 | + */ |
42 | 117 | @JsonProperty("rate")
|
43 | 118 | public void setValue(Double value) {
|
44 | 119 | this._value = value;
|
|
0 commit comments