Top Description Constructors Methods
org.javamoney.moneta.function

pack-priv final Class ConvertMinorPartQuery

extends Object
implements MonetaryQuery<Long>
Class Inheritance
All Implemented Interfaces
javax.money.MonetaryQuery
Imports
java.math.BigDecimal, .RoundingMode, java.util.Objects, javax.money.CurrencyUnit, .MonetaryAmount, .MonetaryQuery

This class allows to convert to minor part a MonetaryAmount instance. Recovery all value as minor units as a long.

This returns the monetary amount in terms of the minor units of the currency, truncating the amount if necessary. For example, 'EUR 2.35' will return 235, and 'BHD -1.345' will return -1345.

Author
Anatole Tresch

Constructor Summary

AccessConstructor and Description
pack-priv
ConvertMinorPartQuery()

Private constructor, there is only one instance of this class, accessible calling MonetaryOperators#minorPart().

Method Summary

Modifier and TypeMethod and Description
public Long

Returns:

the minor units part of the amount
queryFrom
(MonetaryAmount amount)

Implements javax.money.MonetaryQuery.queryFrom.

Gets the amount in minor units as a long.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

ConvertMinorPartQueryback to summary
pack-priv ConvertMinorPartQuery()

Private constructor, there is only one instance of this class, accessible calling MonetaryOperators#minorPart().

Method Detail

queryFromback to summary
public Long queryFrom(MonetaryAmount amount)

Implements javax.money.MonetaryQuery.queryFrom.

Gets the amount in minor units as a long.

This returns the monetary amount in terms of the minor units of the currency, truncating the amount if necessary. For example, 'EUR 2.35' will return 235, and 'BHD -1.345' will return -1345.

This method matches the API of java.math.BigDecimal.

Returns:Long

the minor units part of the amount

Annotations
@Override
Exceptions
ArithmeticException:
if the amount is too large for a long