Search in sources :

Example 21 with Money

use of org.javamoney.moneta.Money in project jsr354-ri by JavaMoney.

the class StreamFactory method streamNull.

public static Stream<MonetaryAmount> streamNull() {
    Money m1 = Money.of(BigDecimal.TEN, BRAZILIAN_REAL);
    Money m2 = Money.of(BigDecimal.ZERO, BRAZILIAN_REAL);
    Money m3 = Money.of(BigDecimal.ONE, BRAZILIAN_REAL);
    Money m4 = Money.of(BigDecimal.valueOf(4L), BRAZILIAN_REAL);
    Money m5 = Money.of(BigDecimal.valueOf(5L), BRAZILIAN_REAL);
    return Stream.of(m1, m2, m3, m4, m5, null);
}
Also used : Money(org.javamoney.moneta.Money)

Example 22 with Money

use of org.javamoney.moneta.Money in project jsr354-ri by JavaMoney.

the class StreamFactory method streamCurrencyDifferent.

public static Stream<MonetaryAmount> streamCurrencyDifferent() {
    Money m1 = Money.of(BigDecimal.TEN, BRAZILIAN_REAL);
    Money m2 = Money.of(BigDecimal.ZERO, BRAZILIAN_REAL);
    Money m3 = Money.of(BigDecimal.ONE, BRAZILIAN_REAL);
    Money m4 = Money.of(BigDecimal.valueOf(4L), EURO);
    Money m5 = Money.of(BigDecimal.valueOf(5L), BRAZILIAN_REAL);
    return Stream.of(m1, m2, m3, m4, m5);
}
Also used : Money(org.javamoney.moneta.Money)

Example 23 with Money

use of org.javamoney.moneta.Money in project jsr354-ri by JavaMoney.

the class StreamFactory method streamNormal.

public static Stream<MonetaryAmount> streamNormal() {
    Money m1 = Money.of(BigDecimal.TEN, BRAZILIAN_REAL);
    Money m2 = Money.of(BigDecimal.ZERO, BRAZILIAN_REAL);
    Money m3 = Money.of(BigDecimal.ONE, BRAZILIAN_REAL);
    Money m4 = Money.of(BigDecimal.valueOf(4L), BRAZILIAN_REAL);
    Money m5 = Money.of(BigDecimal.valueOf(5L), BRAZILIAN_REAL);
    return Stream.of(m1, m2, m3, m4, m5);
}
Also used : Money(org.javamoney.moneta.Money)

Example 24 with Money

use of org.javamoney.moneta.Money in project jsr354-ri by JavaMoney.

the class StreamFactory method currencies.

public static Stream<MonetaryAmount> currencies() {
    Money r1 = Money.of(BigDecimal.TEN, BRAZILIAN_REAL);
    Money r2 = Money.of(BigDecimal.ZERO, BRAZILIAN_REAL);
    Money r3 = Money.of(BigDecimal.ONE, BRAZILIAN_REAL);
    Money e1 = Money.of(BigDecimal.TEN, EURO);
    Money e2 = Money.of(BigDecimal.ZERO, EURO);
    Money e3 = Money.of(BigDecimal.ONE, EURO);
    Money d1 = Money.of(BigDecimal.TEN, DOLLAR);
    Money d2 = Money.of(BigDecimal.ZERO, DOLLAR);
    Money d3 = Money.of(BigDecimal.ONE, DOLLAR);
    return Stream.of(r1, r2, r3, e1, e2, e3, d1, d2, d3);
}
Also used : Money(org.javamoney.moneta.Money)

Example 25 with Money

use of org.javamoney.moneta.Money in project rulesservice by genny-project.

the class MoneyHelper method sub.

public static Money sub(Money inputMoney, Number number) {
    Money result = Money.of(0, DEFAULT_CURRENCY);
    if (inputMoney != null && number != null) {
        Number numberFromMoney = inputMoney.getNumber();
        Number resultNumber = sub(numberFromMoney, number);
        result = Money.of(resultNumber, inputMoney.getCurrency());
    }
    return result;
}
Also used : Money(org.javamoney.moneta.Money)

Aggregations

Money (org.javamoney.moneta.Money)31 AttributeMoney (life.genny.qwanda.attribute.AttributeMoney)7 CurrencyUnit (javax.money.CurrencyUnit)4 MonetaryAmount (javax.money.MonetaryAmount)4 FastMoney (org.javamoney.moneta.FastMoney)4 Test (org.junit.Test)4 BaseEntity (life.genny.qwanda.entity.BaseEntity)3 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 LinkedHashMap (java.util.LinkedHashMap)2 Scanner (java.util.Scanner)2 Answer (life.genny.qwanda.Answer)2 QRules (life.genny.rules.QRules)2 Test (org.testng.annotations.Test)2 IOException (java.io.IOException)1 HashSet (java.util.HashSet)1 CurrencyConversion (javax.money.convert.CurrencyConversion)1 ExchangeRateProvider (javax.money.convert.ExchangeRateProvider)1 MonetaryAmountFormat (javax.money.format.MonetaryAmountFormat)1 AttributeBoolean (life.genny.qwanda.attribute.AttributeBoolean)1