Class ReportingCurrency

  • All Implemented Interfaces:
    Serializable, org.joda.beans.Bean, org.joda.beans.ImmutableBean

    public final class ReportingCurrency
    extends Object
    implements org.joda.beans.ImmutableBean, Serializable
    The reporting currency.

    This is used to specify the currency that the result should be reporting in. The currency specified may be explicit, using of(Currency), or implicit using NATURAL. The "natural" currency of a target is obtained from CalculationFunction.naturalCurrency(CalculationTarget, ReferenceData).

    If the result is not associated with a currency, such as for "par rate", then the reporting currency will effectively be ignored.

    See Also:
    Serialized Form
    • Field Detail

      • NONE

        public static final ReportingCurrency NONE
        An instance requesting no currency conversion.

        Calculation results are normally converted to a single currency. If this reporting currency is used, then no currency conversion will be performed.

    • Method Detail

      • of

        public static ReportingCurrency of​(Currency currency)
        Obtains an instance requesting the specified currency.

        When converting calculation results, conversion will occur to the specified currency. This returns an instance with the type ReportingCurrencyType.SPECIFIC.

        Parameters:
        currency - the specific currency
        Returns:
        a reporting currency instance requesting the specified currency
      • isSpecific

        public boolean isSpecific()
        Checks if the type is 'Specific'.

        When converting calculation results, conversion will occur to the specific currency returned by getCurrency().

        Returns:
        true if the type is 'Specific'
      • isNone

        public boolean isNone()
        Checks if the type is 'None'.

        Calculation results are normally converted to a single currency. If this returns true than no currency conversion will be performed.

        Returns:
        true if the type is 'None'
      • getCurrency

        public Currency getCurrency()
        Gets the currency if the type is 'Specific'.

        If the type is 'Specific', this returns the currency. Otherwise, this throws an exception. As such, the type must be checked using #is

        Returns:
        the currency, only available if the type is 'Specific'
        Throws:
        IllegalStateException - if called on a failure result
      • meta

        public static ReportingCurrency.Meta meta()
        The meta-bean for ReportingCurrency.
        Returns:
        the meta-bean, not null
      • metaBean

        public ReportingCurrency.Meta metaBean()
        Specified by:
        metaBean in interface org.joda.beans.Bean
      • getType

        public ReportingCurrencyType getType()
        Gets the type of reporting currency.
        Returns:
        the value of the property, not null
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object