Class Column

  • All Implemented Interfaces:
    Bean, ImmutableBean

    public final class Column
    extends java.lang.Object
    implements 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.

    • 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 in CalculationRules.

        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 calculated
        currency - 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 in CalculationRules.

        Parameters:
        measure - the measure to be calculated
        parameters - 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 calculated
        currency - the currency to convert to
        parameters - 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,
                                java.lang.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 in CalculationRules.

        Parameters:
        measure - the measure to be calculated
        columnName - the column name
        Returns:
        a column with the specified measure and column name
      • of

        public static Column of​(Measure measure,
                                java.lang.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 calculated
        columnName - the column name
        currency - the currency to convert to
        Returns:
        a column with the specified measure
      • of

        public static Column of​(Measure measure,
                                java.lang.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 in CalculationRules.

        Parameters:
        measure - the measure to be calculated
        columnName - the column name
        parameters - 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,
                                java.lang.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 calculated
        columnName - the column name
        currency - the currency to convert to
        parameters - 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 currency
        defaultParameters - 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 for Column.
        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
      • 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 java.util.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 and Column 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
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object