Package org.joda.money

Examples of org.joda.money.Money


        if (transaction.getAmount() == null) {
            throw new CoinbaseException("Amount is a required field");
        }

        // Massage amount
        Money amount = transaction.getAmount();
        transaction.setAmount(null);

        transaction.setAmountString(amount.getAmount().toPlainString());
        transaction.setAmountCurrencyIso(amount.getCurrencyUnit().getCurrencyCode());

        return transaction;
    }
View Full Code Here


        if (button.getPrice() == null) {
            throw new CoinbaseException("Price is a required field");
        }

        // Massage amount
        Money price = button.getPrice();
        button.setPrice(null);

        button.setPriceString(price.getAmount().toPlainString());
        button.setPriceCurrencyIso(price.getCurrencyUnit().getCurrencyCode());

        return button;
    }
View Full Code Here

    @Override
    public Money deserialize(JsonParser jsonParser, DeserializationContext deserializationContext)
      throws IOException {

  Money result = null;

  ObjectCodec oc = jsonParser.getCodec();
  JsonNode node = oc.readTree(jsonParser);

  String currency = null;
View Full Code Here

        if (button.getPrice() == null) {
            throw new CoinbaseException("Price is a required field");
        }

        // Massage amount
        Money price = button.getPrice();
        button.setPrice(null);

        button.setPriceString(price.getAmount().toPlainString());
        button.setPriceCurrencyIso(price.getCurrencyUnit().getCurrencyCode());

        return button;
    }
View Full Code Here

        if (transaction.getAmount() == null) {
            throw new CoinbaseException("Amount is a required field");
        }

        // Massage amount
        Money amount = transaction.getAmount();
        transaction.setAmount(null);

        transaction.setAmountString(amount.getAmount().toPlainString());
        transaction.setAmountCurrencyIso(amount.getCurrencyUnit().getCurrencyCode());

        return transaction;
    }
View Full Code Here

        if (button.getPrice() == null) {
            throw new CoinbaseException("Price is a required field");
        }

        // Massage amount
        Money price = button.getPrice();
        button.setPrice(null);

        button.setPriceString(price.getAmount().toPlainString());
        button.setPriceCurrencyIso(price.getCurrencyUnit().getCurrencyCode());

        return button;
    }
View Full Code Here

        ObjectOutputStream oos = new ObjectOutputStream(baos);
        oos.writeObject(a);
        oos.close();
        ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(baos.toByteArray()));
        MoneyFormatter input = (MoneyFormatter) ois.readObject();
        Money value = MONEY_GBP_12_34;
        assertEquals(input.print(value), a.print(value));
    }
View Full Code Here

    //-----------------------------------------------------------------------
    // parseMoney(CharSequence)
    //-----------------------------------------------------------------------
    public void test_parseMoney_CharSequence() {
        CharSequence input = new StringBuilder("12.34 GBP");
        Money test = iParseTest.parseMoney(input);
        assertEquals(test, MONEY_GBP_12_34);
    }
View Full Code Here

    }

    public void test_appendAmount_3dp_BHD() {
        iBuilder.appendAmount();
        MoneyFormatter test = iBuilder.toFormatter();
        Money money = Money.of(CurrencyUnit.getInstance("BHD"), 6345345.735d);
        assertEquals(test.print(money), "6,345,345.735");
    }
View Full Code Here

        assertEquals(test.parse(expected, 0).getAmount(), money.getAmount());
    }

    @Test
    public void test_appendAmount_MoneyAmountStyle_JPY_issue49() {
        Money money = Money.parse("JPY 12");
        MoneyAmountStyle style = MoneyAmountStyle.LOCALIZED_GROUPING;
        MoneyFormatter formatter = new MoneyFormatterBuilder()
            .appendAmount(style)
            .toFormatter()
            .withLocale(Locale.JAPAN);
View Full Code Here

TOP

Related Classes of org.joda.money.Money

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.