The class is thread-safe, which is also true for all functions returned by this class.
MonetaryAmount money = Money.parse("EUR 2.35");
MonetaryAmount result = operator.apply(money);
Or using:
MonetaryAmount money = Money.parse("EUR 2.35");
MonetaryAmount result = money.with(operator);
MonetaryAmount#with(MonetaryOperator), MonetaryOperator, MonetaryOperator#apply(MonetaryAmount)
| Modifier and Type | Field and Description |
|---|---|
| private static final MathContext | |
| private static final ExtractorMajorPartOperator | |
| private static final ExtractorMinorPartOperator | |
| private static final ReciprocalOperator | |
| private static final RoundingMonetaryAmountOperator |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static MonetaryOperator | Returns: the major part asMonetaryOperatorExtract major part of This returns the monetary amount in terms of the major units of the currency. |
| public static MonetaryOperator | Returns: the minor part asMonetaryOperatorExtract minor part of This returns the monetary amount in terms of the minor units of the currency, truncating the whole part if necessary. |
| public static MonetaryOperator | Returns: the percent ofMonetaryOperatorthe value to percent decimal)Gets the percentage of the amount. |
| public static MonetaryOperator | Returns: the percent ofMonetaryOperatorto be used in percent number)Gets the percentage of the amount. |
| public static MonetaryOperator | |
| public static MonetaryOperator | Returns: the permilMonetaryOperatorto be converted to number)BigDecimalReturns the |
| public static MonetaryOperator | Returns: the permilMonetaryOperatorto be converted to number, MathContext BigDecimalthe mathContext to be used mathContext)Returns the |
| public static MonetaryOperator | Returns: the reciprocal part asMonetaryOperatorGets the reciprocal of Gets the amount as reciprocal, multiplicative inverse value (1/n). |
| public static MonetaryOperator | Returns: the major part asMonetaryOperatorRounding the |
| public static MonetaryOperator | Returns: the major part asMonetaryOperatorrounding to be used roundingMode)Rounding the |
| public static MonetaryOperator | Returns: the major part asMonetaryOperatorrounding to be used roundingMode, int to be used scale)Rounding the |
| public static MonetaryOperator | Returns: the major part asMonetaryOperatorscale to be used scale)Rounding the |
| DEFAULT_MATH_CONTEXT | back to summary |
|---|---|
| private static final MathContext DEFAULT_MATH_CONTEXT | |
| EXTRACTOR_MAJOR_PART | back to summary |
|---|---|
| private static final ExtractorMajorPartOperator EXTRACTOR_MAJOR_PART | |
| EXTRACTOR_MINOR_PART | back to summary |
|---|---|
| private static final ExtractorMinorPartOperator EXTRACTOR_MINOR_PART | |
| RECIPROCAL | back to summary |
|---|---|
| private static final ReciprocalOperator RECIPROCAL | |
| ROUNDING_MONETARY_AMOUNT | back to summary |
|---|---|
| private static final RoundingMonetaryAmountOperator ROUNDING_MONETARY_AMOUNT | |
| MonetaryOperators | back to summary |
|---|---|
| private MonetaryOperators() | |
| majorPart | back to summary |
|---|---|
| public static MonetaryOperator majorPart() Extract major part of This returns the monetary amount in terms of the major units of the currency. For example, 'EUR 2.35' will return 'EUR 2.0', and 'BHD -1.345' will return 'BHD -1.0'.
| |
| minorPart | back to summary |
|---|---|
| public static MonetaryOperator minorPart() Extract minor part of This returns the monetary amount in terms of the minor units of the currency, truncating the whole part if necessary. For example, 'EUR 2.35' will return 'EUR 0.35', and 'BHD -1.345' will return 'BHD -0.345'.
| |
| percent | back to summary |
|---|---|
| public static MonetaryOperator percent(BigDecimal decimal) Gets the percentage of the amount. This returns the monetary amount in percent. For example, for 10% 'EUR 2.35' will return 0.235.
| |
| percent | back to summary |
|---|---|
| public static MonetaryOperator percent(Number number) Gets the percentage of the amount.
| |
| permil | back to summary |
|---|---|
| public static MonetaryOperator permil(BigDecimal decimal) Gets the permil of the amount. This returns the monetary amount in permil. For example, for 10% 'EUR 2.35' will return 0.235.
| |
| permil | back to summary |
|---|---|
| public static MonetaryOperator permil(Number number) Returns the
| |
| permil | back to summary |
|---|---|
| public static MonetaryOperator permil(Number number, MathContext mathContext) Returns the
| |
| reciprocal | back to summary |
|---|---|
| public static MonetaryOperator reciprocal() Gets the reciprocal of Gets the amount as reciprocal, multiplicative inverse value (1/n).
| |
| rounding | back to summary |
|---|---|
| public static MonetaryOperator rounding() Rounding the For example, 'EUR 2.3523' will return 'EUR 2.35', and 'BHD -1.34534432' will return 'BHD -1.345'.
| |
| rounding | back to summary |
|---|---|
| public static MonetaryOperator rounding(RoundingMode roundingMode) Rounding the For example, 'EUR 2.3523' will return 'EUR 2.35', and 'BHD -1.34534432' will return 'BHD -1.345'.
| |
| rounding | back to summary |
|---|---|
| public static MonetaryOperator rounding(RoundingMode roundingMode, int scale) Rounding the For example, 'EUR 2.3523' will return 'EUR 2.35', and 'BHD -1.34534432' will return 'BHD -1.345'.
| |
| rounding | back to summary |
|---|---|
| public static MonetaryOperator rounding(int scale) Rounding the For example, 'EUR 2.3523' will return 'EUR 2.35', and 'BHD -1.34534432' will return 'BHD -1.345'.
| |