Class ReportingCurrency
- java.lang.Object
-
- com.opengamma.strata.calc.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 usingNATURAL. The "natural" currency of a target is obtained fromCalculationFunction.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
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classReportingCurrency.MetaThe meta-bean forReportingCurrency.
-
Field Summary
Fields Modifier and Type Field Description static ReportingCurrencyNATURALAn instance requesting the "natural" currency of the target.static ReportingCurrencyNONEAn instance requesting no currency conversion.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object obj)CurrencygetCurrency()Gets the currency if the type is 'Specific'.ReportingCurrencyTypegetType()Gets the type of reporting currency.inthashCode()booleanisNatural()Checks if the type is 'Natural'.booleanisNone()Checks if the type is 'None'.booleanisSpecific()Checks if the type is 'Specific'.static ReportingCurrency.Metameta()The meta-bean forReportingCurrency.ReportingCurrency.MetametaBean()static ReportingCurrencyof(Currency currency)Obtains an instance requesting the specified currency.StringtoString()
-
-
-
Field Detail
-
NATURAL
public static final ReportingCurrency NATURAL
An instance requesting the "natural" currency of the target.When converting calculation results, conversion will occur to the "natural" currency of the target. The "natural" currency of a target is obtained from
CalculationFunction.naturalCurrency(CalculationTarget, ReferenceData).
-
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'
-
isNatural
public boolean isNatural()
Checks if the type is 'Natural'.When converting calculation results, conversion will occur to the "natural" currency of the target. The "natural" currency of a target is obtained from
CalculationFunction.naturalCurrency(CalculationTarget, ReferenceData).- Returns:
- true if the type is 'Natural'
-
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 forReportingCurrency.- Returns:
- the meta-bean, not null
-
metaBean
public ReportingCurrency.Meta metaBean()
- Specified by:
metaBeanin interfaceorg.joda.beans.Bean
-
getType
public ReportingCurrencyType getType()
Gets the type of reporting currency.- Returns:
- the value of the property, not null
-
-