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

pack-priv final Class ExtractorMajorPartOperator

extends Object
implements MonetaryOperator
Class Inheritance
All Implemented Interfaces
javax.money.MonetaryOperator
Imports
javax.money.*, java.math.RoundingMode, java.util.Objects

This class allows to extract the major part of a MonetaryAmount instance.
Author
Anatole Tresch

Field Summary

Modifier and TypeField and Description
private static final MonetaryRounding

Constructor Summary

AccessConstructor and Description
pack-priv
ExtractorMajorPartOperator()

Access the shared instance of ExtractorMajorPartOperator for use.

Method Summary

Modifier and TypeMethod and Description
public MonetaryAmount

Returns:

the major units part of the amount, never null
apply
(MonetaryAmount amount)

Implements javax.money.MonetaryOperator.apply.

Gets the amount in major units as a MonetaryAmount with scale 0.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

DOWN_ROUNDINGback to summary
private static final MonetaryRounding DOWN_ROUNDING

Constructor Detail

ExtractorMajorPartOperatorback to summary
pack-priv ExtractorMajorPartOperator()

Access the shared instance of ExtractorMajorPartOperator for use.

Method Detail

applyback to summary
public MonetaryAmount apply(MonetaryAmount amount)

Implements javax.money.MonetaryOperator.apply.

Gets the amount in major units as a MonetaryAmount with scale 0.

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 'EUR 2', and 'BHD -1.345' will return 'BHD -1'.

This is returned as a MonetaryAmount rather than a BigInteger . This is to allow further calculations to be performed on the result. Should you need a BigInteger, simply call asType(BigInteger.class).

Returns:MonetaryAmount

the major units part of the amount, never null

Annotations
@Override