View Javadoc
1   package org.oxerr.okcoin.rest.dto;
2   
3   import java.math.BigDecimal;
4   import java.util.Collections;
5   import java.util.Map;
6   
7   import com.fasterxml.jackson.annotation.JsonProperty;
8   
9   public class Funds extends BaseObject {
10  
11  	private static final long serialVersionUID = 20140614L;
12  
13  	private final Map<String, BigDecimal> asset;
14  	private final Map<String, BigDecimal> borrow;
15  	private final Map<String, BigDecimal> free;
16  	private final Map<String, BigDecimal> frozen;
17  	private final Map<String, BigDecimal> unionFund;
18  
19  	public Funds(
20  			@JsonProperty("asset") final Map<String, BigDecimal> asset,
21  			@JsonProperty("borrow") final Map<String, BigDecimal> borrow,
22  			@JsonProperty("free") final Map<String, BigDecimal> free,
23  			@JsonProperty("freezed") final Map<String, BigDecimal> frozen,
24  			@JsonProperty("union_fund") final Map<String, BigDecimal> unionFund) {
25  		this.asset     = nonNull(asset);
26  		this.borrow    = nonNull(borrow);
27  		this.free      = nonNull(free);
28  		this.frozen    = nonNull(frozen);
29  		this.unionFund = nonNull(unionFund);
30  	}
31  
32  	private static Map<String, BigDecimal> nonNull(final Map<String, BigDecimal> map) {
33  		return map == null ? Collections.emptyMap() : map;
34  	}
35  
36  	/**
37  	 * Returns the account funds, including net fund and total fund.
38  	 *
39  	 * @return the account funds, including net fund and total fund.
40  	 */
41  	public Map<String, BigDecimal> getAsset() {
42  		return asset;
43  	}
44  
45  	/**
46  	 * Returns the account borrowing information (only returned when this
47  	 * field is not null).
48  	 *
49  	 * @return the account borrowing information.
50  	 */
51  	public Map<String, BigDecimal> getBorrow() {
52  		return borrow;
53  	}
54  
55  	/**
56  	 * Returns the available fund.
57  	 *
58  	 * @return the available fund.
59  	 */
60  	public Map<String, BigDecimal> getFree() {
61  		return free;
62  	}
63  
64  	/**
65  	 * Returns the frozen funds.
66  	 *
67  	 * @return the frozen funds.
68  	 */
69  	public Map<String, BigDecimal> getFrozen() {
70  		return frozen;
71  	}
72  
73  	/**
74  	 * Returns the fund management information (only returned when this
75  	 * field is not null).
76  	 *
77  	 * @return the fund management information.
78  	 */
79  	public Map<String, BigDecimal> getUnionFund() {
80  		return unionFund;
81  	}
82  
83  }