@Override public String toNonNullValue(CurrencyUnit value) { return value.getCurrencyCode(); } }
@Override public void serialize(CurrencyUnit value, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonGenerationException { jgen.writeString(value.getCurrencyCode()); }
@Override public void serialize(CurrencyUnit value, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonGenerationException { jgen.writeString(value.getCurrencyCode()); }
public String getSendLimitCurrency() { if (_sendLimitAmount != null) { return _sendLimitAmount.getCurrencyUnit().getCurrencyCode(); } else { return null; } } }
public String getSendLimitCurrency() { if (_sendLimitAmount != null) { return _sendLimitAmount.getCurrencyUnit().getCurrencyCode(); } else { return null; } } }
@Override public String toNonNullString(CurrencyUnit value) { String str = value.getNumeric3Code(); if ("".equals(str)) { return value.getCurrencyCode(); } else { return str; } } }
@Override public Money getSpotPrice(CurrencyUnit currency) throws IOException, CoinbaseException { URL spotPriceUrl; try { spotPriceUrl = new URL(_baseApiUrl, "prices/spot_rate?currency=" + URLEncoder.encode(currency.getCurrencyCode(), "UTF-8")); } catch (MalformedURLException ex) { throw new AssertionError(ex); } return deserialize(doHttp(spotPriceUrl, "GET", null), Money.class); }
@Override public Money getSpotPrice(CurrencyUnit currency) throws IOException, CoinbaseException { URL spotPriceUrl; try { spotPriceUrl = new URL(_baseApiUrl, "prices/spot_rate?currency=" + URLEncoder.encode(currency.getCurrencyCode(), "UTF-8")); } catch (MalformedURLException ex) { throw new AssertionError(ex); } return deserialize(doHttp(spotPriceUrl, "GET", null), Money.class); }
public void addTick(ATPTicker tick) { CurrencyUnit currency = CurrencyUnit.getInstance(tick.getLast().getCurrencyUnit().getCurrencyCode()); if(!currency.getCode().equals("BTC")) { synchronized(lastTickMap) { lastTickMap.put(currency, tick); } } }
@JsonProperty @JsonDeserialize(using=MoneyDeserializer.class) public void setAmount(Money amount) { _amount = amount; if (amount != null) { setAmountString(amount.getAmount().toPlainString()); setAmountCurrencyIso(amount.getCurrencyUnit().getCurrencyCode()); } else { setAmountString(null); setAmountCurrencyIso(null); } }
@Override public BigDecimal toNonNullValue(Money value) { if (!currencyUnit.equals(value.getCurrencyUnit())) { throw new IllegalStateException("Expected currency " + currencyUnit.getCurrencyCode() + " but was " + value.getCurrencyUnit()); } return value.getAmount(); }
@JsonProperty @JsonDeserialize(using=MoneyDeserializer.class) public void setAmount(Money amount) { _amount = amount; if (amount != null) { setAmountString(amount.getAmount().toPlainString()); setAmountCurrencyIso(amount.getCurrencyUnit().getCurrencyCode()); } else { setAmountString(null); setAmountCurrencyIso(null); } }
@Override public Long toNonNullValue(Money value) { if (!currencyUnit.equals(value.getCurrencyUnit())) { throw new IllegalStateException("Expected currency " + currencyUnit.getCurrencyCode() + " but was " + value.getCurrencyUnit()); } return value.getAmountMajorLong(); }
@Override public Long toNonNullValue(Money value) { if (!currencyUnit.equals(value.getCurrencyUnit())) { throw new IllegalStateException("Expected currency " + currencyUnit.getCurrencyCode() + " but was " + value.getCurrencyUnit()); } return value.getAmountMinorLong(); }
@Override public Long toNonNullValue(BigMoney value) { if (!currencyUnit.equals(value.getCurrencyUnit())) { throw new IllegalStateException("Expected currency " + currencyUnit.getCurrencyCode() + " but was " + value.getCurrencyUnit()); } return value.toBigMoney().getAmountMajorLong(); }
@Override public BigDecimal toNonNullValue(BigMoney value) { if (!currencyUnit.equals(value.getCurrencyUnit())) { throw new IllegalStateException("Expected currency " + currencyUnit.getCurrencyCode() + " but was " + value.getCurrencyUnit()); } return BigMoney.of(value).getAmount(); }
@Override public Long toNonNullValue(BigMoney value) { if (!currencyUnit.equals(value.getCurrencyUnit())) { throw new IllegalStateException("Expected currency " + currencyUnit.getCurrencyCode() + " but was " + value.getCurrencyUnit()); } return value.toBigMoney().getAmountMinorLong(); }
public void setPrice(Money price) { _price = price; if (price != null) { setPriceString(price.getAmount().toPlainString()); setPriceCurrencyIso(price.getCurrencyUnit().getCurrencyCode()); } else { setPriceString(null); setPriceCurrencyIso(null); } } }
public void setPrice(Money price) { _price = price; if (price != null) { setPriceString(price.getAmount().toPlainString()); setPriceCurrencyIso(price.getCurrencyUnit().getCurrencyCode()); } else { setPriceString(null); setPriceCurrencyIso(null); } } }
@Override public void nullSafeSet(PreparedStatement st, Object value, int index, SessionImplementor session) throws HibernateException, SQLException { if (value == null) { BigDecimalType.INSTANCE.set(st, null, index, session); StringType.INSTANCE.set(st, null, index + 1, session); } else { Money money = (Money) value; BigDecimalType.INSTANCE.set(st, money.getAmount(), index, session); StringType.INSTANCE.set(st, money.getCurrencyUnit().getCurrencyCode(), index + 1, session); } }