Class TradeCounterpartyCalculationParameter
- java.lang.Object
-
- com.opengamma.strata.measure.calc.TradeCounterpartyCalculationParameter
-
- All Implemented Interfaces:
CalculationParameter
,Serializable
,org.joda.beans.Bean
,org.joda.beans.ImmutableBean
public final class TradeCounterpartyCalculationParameter extends Object implements CalculationParameter, org.joda.beans.ImmutableBean, Serializable
A calculation parameter that selects the parameter based on the counterparty of the target.This can be used where a
CalculationParameter
is required, and will select an underlying parameter based on the trade counterparty represented byStandardId
.- See Also:
- Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object obj)
Optional<CalculationParameter>
filter(CalculationTarget target, Measure measure)
Filters this parameter to the specified target and measure.CalculationParameter
getDefaultParameter()
Gets the default underlying parameter.ImmutableMap<StandardId,CalculationParameter>
getParameters()
Gets the underlying parameters, keyed by counterparty ID.Class<? extends CalculationParameter>
getQueryType()
Gets the parameter query type.int
hashCode()
static org.joda.beans.TypedMetaBean<TradeCounterpartyCalculationParameter>
meta()
The meta-bean forTradeCounterpartyCalculationParameter
.org.joda.beans.TypedMetaBean<TradeCounterpartyCalculationParameter>
metaBean()
static TradeCounterpartyCalculationParameter
of(Map<StandardId,CalculationParameter> parameters, CalculationParameter defaultParameter)
Obtains an instance from the specified parameters.Class<? extends CalculationParameter>
queryType()
Gets the type that the parameter will be queried by.String
toString()
-
-
-
Method Detail
-
of
public static TradeCounterpartyCalculationParameter of(Map<StandardId,CalculationParameter> parameters, CalculationParameter defaultParameter)
Obtains an instance from the specified parameters.The map provides a lookup from the
CalculationTarget
implementation type to the appropriate parameter to use for that target. If a target is requested that is not in the map, the default parameter is used.- Parameters:
parameters
- the parameters, keyed by target typedefaultParameter
- the default parameter- Returns:
- the target aware parameter
-
queryType
public Class<? extends CalculationParameter> queryType()
Description copied from interface:CalculationParameter
Gets the type that the parameter will be queried by.Parameters can be queried using
CalculationParameters.findParameter(Class)
. This type is the key that callers must use in that method.By default, this is just
Object.getClass()
. It will only differ if the query type is an interface rather than the concrete class.- Specified by:
queryType
in interfaceCalculationParameter
- Returns:
- the type of the parameter implementation
-
filter
public Optional<CalculationParameter> filter(CalculationTarget target, Measure measure)
Description copied from interface:CalculationParameter
Filters this parameter to the specified target and measure.Parameters may apply to all targets and measures or just a subset. The
CalculationParameters.filter(CalculationTarget, Measure)
method uses this method to filter a complete set of parameters.By default, this returns
Optional.of(this)
. If the parameter does not apply to either the target or measure, then optional empty must be returned. If desired, the result can be a different parameter, allowing one parameter to delegate to another when filtered.- Specified by:
filter
in interfaceCalculationParameter
- Parameters:
target
- the calculation target, such as a trademeasure
- the measure to be calculated- Returns:
- the parameter appropriate to the target and measure, empty if this parameter does not apply
-
meta
public static org.joda.beans.TypedMetaBean<TradeCounterpartyCalculationParameter> meta()
The meta-bean forTradeCounterpartyCalculationParameter
.- Returns:
- the meta-bean, not null
-
metaBean
public org.joda.beans.TypedMetaBean<TradeCounterpartyCalculationParameter> metaBean()
- Specified by:
metaBean
in interfaceorg.joda.beans.Bean
-
getQueryType
public Class<? extends CalculationParameter> getQueryType()
Gets the parameter query type.- Returns:
- the value of the property, not null
-
getParameters
public ImmutableMap<StandardId,CalculationParameter> getParameters()
Gets the underlying parameters, keyed by counterparty ID.- Returns:
- the value of the property, not null
-
getDefaultParameter
public CalculationParameter getDefaultParameter()
Gets the default underlying parameter.- Returns:
- the value of the property, not null
-
-