Skip to content

Commit 329cb7b

Browse files
committed
SP-230 Add example JavaDoc for com.bitpay.sdk.model.Rate
1 parent 3e3fa75 commit 329cb7b

File tree

2 files changed

+76
-1
lines changed

2 files changed

+76
-1
lines changed

Diff for: LICENSE renamed to LICENSE.md

File renamed without changes.

Diff for: src/main/java/com/bitpay/sdk/model/Rate/Rate.java

+76-1
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,119 @@
1+
/*
2+
* Copyright (c) 2019 BitPay
3+
*/
14
package com.bitpay.sdk.model.Rate;
25

36
import com.fasterxml.jackson.annotation.JsonIgnore;
47
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
58
import com.fasterxml.jackson.annotation.JsonProperty;
69

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+
*/
730
@JsonIgnoreProperties(ignoreUnknown = true)
831
public class Rate {
932

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+
*/
1140
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+
*/
1254
private Double _value;
1355

56+
/**
57+
* Class constructor.
58+
*/
1459
public Rate() {
1560
}
1661

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+
*/
1767
@JsonIgnore
1868
public String getName() {
1969
return _name;
2070
}
2171

72+
/**
73+
* Sets the name of the rate's currency or cryptocurrency.
74+
*
75+
* @param name the name of the rate
76+
*/
2277
@JsonProperty("name")
2378
public void setName(String name) {
2479
this._name = name;
2580
}
2681

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+
*/
2787
@JsonIgnore
2888
public String getCode() {
2989
return _code;
3090
}
3191

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+
*/
3297
@JsonProperty("code")
3398
public void setCode(String code) {
3499
this._code = code;
35100
}
36101

102+
/**
103+
* Returns the numeric value of the rate.
104+
*
105+
* @return the numeric value of the rate, to two decimal places
106+
*/
37107
@JsonIgnore
38108
public Double getValue() {
39109
return _value;
40110
}
41111

112+
/**
113+
* Sets the numeric value of the rate.
114+
*
115+
* @param value the numeric value of the rate, to two decimal places
116+
*/
42117
@JsonProperty("rate")
43118
public void setValue(Double value) {
44119
this._value = value;

0 commit comments

Comments
 (0)