public final class CalculationParameters extends Object implements org.joda.beans.ImmutableBean, Serializable
This provides a set of parameters that will be used in a calculation.
Each parameter defines a query type,
thus the functions are keyed in a Map by the query type Class.
Parameters exist to provide control over the calculation.
For example, ReportingCurrency is a parameter that controls currency conversion.
If specified, on a Column, or in CalculationRules, then the output will
be converted to the specified currency.
| Modifier and Type | Method and Description |
|---|---|
CalculationParameters |
combinedWith(CalculationParameters other)
Combines this set of parameters with the specified set.
|
static CalculationParameters |
empty()
Obtains an empty instance with no parameters.
|
boolean |
equals(Object obj) |
CalculationParameters |
filter(CalculationTarget target,
Measure measure)
Filters the parameters, matching only those that are applicable for the target and measure.
|
<T extends CalculationParameter> |
findParameter(Class<T> type)
Finds the parameter that matches the specified query type.
|
<T extends CalculationParameter> |
getParameter(Class<T> type)
Returns the parameter that matches the specified query type throwing an exception if not available.
|
ImmutableMap<Class<? extends CalculationParameter>,CalculationParameter> |
getParameters()
Gets the parameters, keyed by query type.
|
int |
hashCode() |
static org.joda.beans.TypedMetaBean<CalculationParameters> |
meta()
The meta-bean for
CalculationParameters. |
org.joda.beans.TypedMetaBean<CalculationParameters> |
metaBean() |
static CalculationParameters |
of(CalculationParameter... parameters)
Obtains an instance from the specified parameters.
|
static CalculationParameters |
of(List<? extends CalculationParameter> parameters)
Obtains an instance from the specified parameters.
|
String |
toString() |
CalculationParameters |
with(CalculationParameter parameter)
Returns a copy of this instance with the specified parameter added.
|
CalculationParameters |
without(Class<? extends CalculationParameter> type)
Filters the parameters, returning a set without the specified type.
|
public static CalculationParameters empty()
public static CalculationParameters of(CalculationParameter... parameters)
The list will be converted to a Map using CalculationParameter.queryType().
Each parameter must refer to a different query type.
If a parameter implements an interface that also extends CalculationParameter,
that type will also be able to be searched for (unless it has been directly registered).
parameters - the parametersIllegalArgumentException - if two parameters have same query typepublic static CalculationParameters of(List<? extends CalculationParameter> parameters)
The list will be converted to a Map using CalculationParameter.queryType().
Each parameter must refer to a different query type.
If a parameter implements an interface that also extends CalculationParameter,
that type will also be able to be searched for (unless it has been directly registered).
parameters - the parametersIllegalArgumentException - if two parameters have same query typepublic CalculationParameters combinedWith(CalculationParameters other)
This set of parameters takes priority.
other - the other parameterspublic CalculationParameters with(CalculationParameter parameter)
If this instance already has a parameter with the query type, it will be replaced.
parameter - the parameter to addpublic CalculationParameters without(Class<? extends CalculationParameter> type)
type - the type to removepublic CalculationParameters filter(CalculationTarget target, Measure measure)
The resulting parameters are filtered to the target and measure. The implementation of each parameter may be changed by this process. If two parameters are filtered to the same query type then an exception will be thrown
target - the calculation target, such as a trademeasure - the measure to be calculatedIllegalArgumentException - if two parameters are filtered to the same query typepublic <T extends CalculationParameter> Optional<T> findParameter(Class<T> type)
This method may throw an exception if the parameters have not been filtered.
T - the type of the parametertype - the query type to findpublic <T extends CalculationParameter> T getParameter(Class<T> type)
This method may throw an exception if the parameters have not been filtered.
T - the type of the parametertype - the query type to returnIllegalArgumentException - if no parameter if found for the typepublic static org.joda.beans.TypedMetaBean<CalculationParameters> meta()
CalculationParameters.public org.joda.beans.TypedMetaBean<CalculationParameters> metaBean()
metaBean in interface org.joda.beans.Beanpublic ImmutableMap<Class<? extends CalculationParameter>,CalculationParameter> getParameters()
Copyright 2009-Present by OpenGamma Inc. and individual contributors
Apache v2 licensed
Additional documentation can be found at strata.opengamma.io.