Class Column
- java.lang.Object
-
- com.opengamma.strata.calc.Column
-
- All Implemented Interfaces:
org.joda.beans.Bean
,org.joda.beans.ImmutableBean
public final class Column extends Object implements org.joda.beans.ImmutableBean
Defines a column in a set of calculation results.CalculationRunner
provides the ability to calculate a grid of results for a given set targets and columns. This class is used to define the columns.A column is defined in terms of a unique name, measure to be calculated and a set of parameters that control the calculation. The functions to invoke and the default set of parameters are defined on
CalculationRules
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Column.Builder
The bean-builder forColumn
.static class
Column.Meta
The meta-bean forColumn
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Column.Builder
builder()
Returns a builder used to create an instance of the bean.Column
combineWithDefaults(ReportingCurrency reportingCurrency, CalculationParameters defaultParameters)
Combines the parameters with another reporting currency and set of parameters.boolean
equals(Object obj)
Measure
getMeasure()
Gets the measure to be calculated.ColumnName
getName()
Gets the column name.CalculationParameters
getParameters()
Gets the calculation parameters that apply to this column, used to control the how the calculation is performed.Optional<ReportingCurrency>
getReportingCurrency()
Gets the reporting currency, used to control currency conversion, optional.int
hashCode()
static Column.Meta
meta()
The meta-bean forColumn
.Column.Meta
metaBean()
static Column
of(Measure measure)
Obtains an instance that will calculate the specified measure.static Column
of(Measure measure, Currency currency)
Obtains an instance that will calculate the specified measure, converting to the specified currency.static Column
of(Measure measure, Currency currency, CalculationParameter... parameters)
Obtains an instance that will calculate the specified measure, converting to the specified currency, defining additional parameters.static Column
of(Measure measure, CalculationParameter... parameters)
Obtains an instance that will calculate the specified measure, defining additional parameters.static Column
of(Measure measure, String columnName)
Obtains an instance that will calculate the specified measure, defining the column name.static Column
of(Measure measure, String columnName, Currency currency)
Obtains an instance that will calculate the specified measure, converting to the specified currency.static Column
of(Measure measure, String columnName, Currency currency, CalculationParameter... parameters)
Obtains an instance that will calculate the specified measure, converting to the specified currency, defining the column name and parameters.static Column
of(Measure measure, String columnName, CalculationParameter... parameters)
Obtains an instance that will calculate the specified measure, defining the column name and parameters.Column.Builder
toBuilder()
Returns a builder that allows this bean to be mutated.ColumnHeader
toHeader()
Converts this column to a column header.String
toString()
-
-
-
Method Detail
-
of
public static Column of(Measure measure)
Obtains an instance that will calculate the specified measure.The column name will be the same as the name of the measure. No calculation parameters are provided, thus the parameters from
CalculationRules
will be used. Currency conversion is controlled by the reporting currency inCalculationRules
.- Parameters:
measure
- the measure to be calculated- Returns:
- a column with the specified measure
-
of
public static Column of(Measure measure, Currency currency)
Obtains an instance that will calculate the specified measure, converting to the specified currency.The column name will be the same as the name of the measure.
- Parameters:
measure
- the measure to be calculatedcurrency
- the currency to convert to- Returns:
- a column with the specified measure
-
of
public static Column of(Measure measure, CalculationParameter... parameters)
Obtains an instance that will calculate the specified measure, defining additional parameters.The column name will be the same as the name of the measure. The specified calculation parameters take precedence over those in
CalculationRules
, with the combined set being used for the column. Currency conversion is controlled by the reporting currency inCalculationRules
.- Parameters:
measure
- the measure to be calculatedparameters
- the parameters that control the calculation, may be empty- Returns:
- a column with the specified measure and reporting currency
-
of
public static Column of(Measure measure, Currency currency, CalculationParameter... parameters)
Obtains an instance that will calculate the specified measure, converting to the specified currency, defining additional parameters.The column name will be the same as the name of the measure. The specified calculation parameters take precedence over those in
CalculationRules
, with the combined set being used for the column.- Parameters:
measure
- the measure to be calculatedcurrency
- the currency to convert toparameters
- the parameters that control the calculation, may be empty- Returns:
- a column with the specified measure and reporting currency
-
of
public static Column of(Measure measure, String columnName)
Obtains an instance that will calculate the specified measure, defining the column name.No calculation parameters are provided, thus the parameters from
CalculationRules
will be used. Currency conversion is controlled by the reporting currency inCalculationRules
.- Parameters:
measure
- the measure to be calculatedcolumnName
- the column name- Returns:
- a column with the specified measure and column name
-
of
public static Column of(Measure measure, String columnName, Currency currency)
Obtains an instance that will calculate the specified measure, converting to the specified currency.The specified currency will be wrapped in
ReportingCurrency
and added to the calculation parameters.- Parameters:
measure
- the measure to be calculatedcolumnName
- the column namecurrency
- the currency to convert to- Returns:
- a column with the specified measure
-
of
public static Column of(Measure measure, String columnName, CalculationParameter... parameters)
Obtains an instance that will calculate the specified measure, defining the column name and parameters.The specified calculation parameters take precedence over those in
CalculationRules
, with the combined set being used for the column. Currency conversion is controlled by the reporting currency inCalculationRules
.- Parameters:
measure
- the measure to be calculatedcolumnName
- the column nameparameters
- the parameters that control the calculation, may be empty- Returns:
- a column with the specified measure, column name and reporting currency
-
of
public static Column of(Measure measure, String columnName, Currency currency, CalculationParameter... parameters)
Obtains an instance that will calculate the specified measure, converting to the specified currency, defining the column name and parameters.The specified calculation parameters take precedence over those in
CalculationRules
, with the combined set being used for the column.- Parameters:
measure
- the measure to be calculatedcolumnName
- the column namecurrency
- the currency to convert toparameters
- the parameters that control the calculation, may be empty- Returns:
- a column with the specified measure, column name and reporting currency
-
combineWithDefaults
public Column combineWithDefaults(ReportingCurrency reportingCurrency, CalculationParameters defaultParameters)
Combines the parameters with another reporting currency and set of parameters.- Parameters:
reportingCurrency
- the default reporting currencydefaultParameters
- the default parameters- Returns:
- the combined column
-
toHeader
public ColumnHeader toHeader()
Converts this column to a column header.The header is a reduced form of the column used in
Results
.- Returns:
- the column header
-
meta
public static Column.Meta meta()
The meta-bean forColumn
.- Returns:
- the meta-bean, not null
-
builder
public static Column.Builder builder()
Returns a builder used to create an instance of the bean.- Returns:
- the builder, not null
-
metaBean
public Column.Meta metaBean()
- Specified by:
metaBean
in interfaceorg.joda.beans.Bean
-
getName
public ColumnName getName()
Gets the column name.This is the name of the column, and should be unique in a list of columns.
- Returns:
- the value of the property, not null
-
getMeasure
public Measure getMeasure()
Gets the measure to be calculated.This defines the calculation being performed, such as 'PresentValue' or 'ParRate'.
- Returns:
- the value of the property, not null
-
getReportingCurrency
public Optional<ReportingCurrency> getReportingCurrency()
Gets the reporting currency, used to control currency conversion, optional.This is used to specify the currency that the result should be reporting in. If the result is not associated with a currency, such as for "par rate", then the reporting currency will effectively be ignored.
If empty, the reporting currency from
CalculationRules
will be used.- Returns:
- the optional value of the property, not null
-
getParameters
public CalculationParameters getParameters()
Gets the calculation parameters that apply to this column, used to control the how the calculation is performed.The parameters from
CalculationRules
andColumn
are combined. If a parameter is defined here and in the rules with the same query type, then the column parameter takes precedence.When building, these will default to be empty.
- Returns:
- the value of the property
-
toBuilder
public Column.Builder toBuilder()
Returns a builder that allows this bean to be mutated.- Returns:
- the mutable builder, not null
-
-