Top Description Constructors Methods
org.javamoney.moneta.function

pack-priv final Class ReciprocalOperator

extends Object
implements MonetaryOperator
Class Inheritance
All Implemented Interfaces
javax.money.MonetaryOperator
Imports
java.math.BigDecimal, javax.money.MonetaryAmount, .MonetaryOperator, .NumberValue

This class allows to extract the reciprocal value (multiplicative inversion) of a MonetaryAmount instance.
Author
Anatole Tresch

Constructor Summary

AccessConstructor and Description
pack-priv
ReciprocalOperator()

Access the shared instance of ReciprocalOperator for use.

Method Summary

Modifier and TypeMethod and Description
public MonetaryAmount

Returns:

the reciprocal / multiplicative inversed of the amount
apply
(MonetaryAmount amount)

Implements javax.money.MonetaryOperator.apply.

Gets the amount as reciprocal / multiplicative inversed value (1/n).

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

ReciprocalOperatorback to summary
pack-priv ReciprocalOperator()

Access the shared instance of ReciprocalOperator for use.

Method Detail

applyback to summary
public MonetaryAmount apply(MonetaryAmount amount)

Implements javax.money.MonetaryOperator.apply.

Gets the amount as reciprocal / multiplicative inversed value (1/n).

E.g. 'EUR 2.0' will be converted to 'EUR 0.5'.

Returns:MonetaryAmount

the reciprocal / multiplicative inversed of the amount

Annotations
@Override
Exceptions
ArithmeticException:
if the arithmetic operation failed