Top Description Fields Constructors Methods
org.javamoney.moneta.function

pack-priv final Class ExtractorMajorPartQuery

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

This class allows to extract the major part of a MonetaryAmount instance. Gets the amount in major units as a long.

For example, 'EUR 2.35' will return 2, and 'BHD -1.345' will return -1.

Authors
Anatole Tresch, Otavio Santana

Field Summary

Modifier and TypeField and Description
private final MonetaryOperator

Constructor Summary

AccessConstructor and Description
pack-priv
ExtractorMajorPartQuery()

Access the shared instance of ExtractorMajorPartQuery for use.

Method Summary

Modifier and TypeMethod and Description
public Long

Returns:

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

Implements javax.money.MonetaryQuery.queryFrom.

Gets the amount in major units as a long.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

downRoundingback to summary
private final MonetaryOperator downRounding

Constructor Detail

ExtractorMajorPartQueryback to summary
pack-priv ExtractorMajorPartQuery()

Access the shared instance of ExtractorMajorPartQuery for use.

Method Detail

queryFromback to summary
public Long queryFrom(MonetaryAmount amount)

Implements javax.money.MonetaryQuery.queryFrom.

Gets the amount in major units as a long.

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

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

Returns:Long

the major units part of the amount

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