public class CryptoAmount extends Amount
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CURRENCY_CODE_BTC |
static java.lang.String |
CURRENCY_CODE_LTC |
protected java.lang.String |
currencyCode |
protected Magnetude |
magnetude |
protected long |
value |
Constructor and Description |
---|
CryptoAmount()
Empty Constructor
|
CryptoAmount(javax.json.JsonObject jsonObject)
JSON Parseable constructor
|
CryptoAmount(long value,
java.lang.String currencyCode)
Default Constructor, without magnitude
|
CryptoAmount(long value,
java.lang.String currencyCode,
Magnetude magnetude)
Default Constructor
|
Modifier and Type | Method and Description |
---|---|
void |
convertToJson(javax.json.JsonObjectBuilder jsonObjectBuilder)
Method that should set the objects property to Json representation.
|
java.lang.String |
getCurrencyCode() |
Magnetude |
getMagnetude() |
long |
getValue() |
void |
parseJson(javax.json.JsonObject jsonObject)
Method to read all properties from a JsonObject into this value object.
|
void |
setCurrencyCode(java.lang.String currencyCode) |
void |
setMagnetude(Magnetude magnetude) |
void |
setValue(long value) |
getType, parseAmountObject
add, addB58, addNotRequired, addNotRequiredB58, getBoolean, getBooleanIfSet, getByteArrayFromB58, getByteArrayFromB58IfSet, getByteArrayFromB64, getByteArrayFromB64IfSet, getByteArrayFromHex, getByteArrayFromHexIfSet, getDate, getDateIfSet, getDouble, getDoubleIfSet, getInt, getIntIfSet, getJsonArray, getJsonArrayIfSet, getJsonObject, getJsonObjectIfSet, getLong, getLongIfSet, getString, getStringIfSet, toJson, toJsonAsString, toString
public static final java.lang.String CURRENCY_CODE_BTC
public static final java.lang.String CURRENCY_CODE_LTC
protected long value
protected java.lang.String currencyCode
protected Magnetude magnetude
public CryptoAmount()
public CryptoAmount(long value, java.lang.String currencyCode)
value
- the amount in smallest unit for the cryptocurrency, for
example set in satoshis for BTC.currencyCode
- the currency code, for example "BTC".public CryptoAmount(long value, java.lang.String currencyCode, Magnetude magnetude)
value
- the amount in smallest unit for the cryptocurrency, for
example set in satoshis for BTC.currencyCode
- the currency code, for example "BTC".magnetude
- If sub units to the value it is possible to specify a magnitude.
for example set to MILLI for millisatoshis for BTC.public CryptoAmount(javax.json.JsonObject jsonObject) throws javax.json.JsonException
jsonObject
- the jsonObject to parse.javax.json.JsonException
- if problems occurred parsing the json data.public long getValue()
public void setValue(long value)
value
- the amount in smallest unit for the cryptocurrency, for
example set in satoshis for BTC.public java.lang.String getCurrencyCode()
public void setCurrencyCode(java.lang.String currencyCode)
currencyCode
- the currency code, for example "BTC".public Magnetude getMagnetude()
public void setMagnetude(Magnetude magnetude)
magnetude
- If sub units to the value it is possible to specify a magnitude.
for example set to MILLI for millisatoshis for BTC.public void convertToJson(javax.json.JsonObjectBuilder jsonObjectBuilder) throws javax.json.JsonException
convertToJson
in class Amount
jsonObjectBuilder
- the json object build to use to set key/values in jsonjavax.json.JsonException
- if problems occurred converting object to JSON.public void parseJson(javax.json.JsonObject jsonObject) throws javax.json.JsonException
parseJson
in class JSONParsable
jsonObject
- the json object to read key and values from and set object properties.javax.json.JsonException
- if problems occurred converting object from JSON.