Class ExplainMap
- java.lang.Object
-
- com.opengamma.strata.market.explain.ExplainMap
-
- All Implemented Interfaces:
FxConvertible<ExplainMap>,Serializable,org.joda.beans.Bean,org.joda.beans.ImmutableBean
public final class ExplainMap extends Object implements FxConvertible<ExplainMap>, org.joda.beans.ImmutableBean, Serializable
A map of explanatory values.This is a loosely defined data structure that allows an explanation of a calculation to be represented.
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classExplainMap.MetaThe meta-bean forExplainMap.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ExplainMapBuilderbuilder()Returns a builder for creating the map.ExplainMapconvertedTo(Currency resultCurrency, FxRateProvider rateProvider)Converts this instance to an equivalent amount in the specified currency.static ExplainMapempty()Creates an instance with no entries.booleanequals(Object obj)StringexplanationString()Gets the explanation as a string.<R> Optional<R>get(ExplainKey<R> key)Gets a value by key.ImmutableMap<ExplainKey<?>,Object>getMap()Gets the map of explanatory values.inthashCode()booleanisEmpty()Returns whether the explanatory map contains no entries.static ExplainMap.Metameta()The meta-bean forExplainMap.ExplainMap.MetametaBean()static ExplainMapof(Map<ExplainKey<?>,Object> map)Creates an instance from a populated map.StringtoString()
-
-
-
Method Detail
-
of
public static ExplainMap of(Map<ExplainKey<?>,Object> map)
Creates an instance from a populated map.- Parameters:
map- the map- Returns:
- the explanatory map
-
empty
public static ExplainMap empty()
Creates an instance with no entries.- Returns:
- the explanatory map
-
builder
public static ExplainMapBuilder builder()
Returns a builder for creating the map.- Returns:
- the builder
-
get
public <R> Optional<R> get(ExplainKey<R> key)
Gets a value by key.- Type Parameters:
R- the type of the key- Parameters:
key- the key to lookup- Returns:
- the value associated with the key
-
explanationString
public String explanationString()
Gets the explanation as a string.This returns a multi-line string containing the string form of the entries.
- Returns:
- the explanation as a string
-
convertedTo
public ExplainMap convertedTo(Currency resultCurrency, FxRateProvider rateProvider)
Description copied from interface:FxConvertibleConverts this instance to an equivalent amount in the specified currency.The result, which may be of a different type, will be expressed in terms of the given currency. Any FX conversion that is required will use rates from the provider.
- Specified by:
convertedToin interfaceFxConvertible<ExplainMap>- Parameters:
resultCurrency- the currency of the resultrateProvider- the provider of FX rates- Returns:
- the converted instance, which should be expressed in the specified currency
-
isEmpty
public boolean isEmpty()
Returns whether the explanatory map contains no entries.- Returns:
- true if no entries are present in the map, false otherwise
-
meta
public static ExplainMap.Meta meta()
The meta-bean forExplainMap.- Returns:
- the meta-bean, not null
-
metaBean
public ExplainMap.Meta metaBean()
- Specified by:
metaBeanin interfaceorg.joda.beans.Bean
-
getMap
public ImmutableMap<ExplainKey<?>,Object> getMap()
Gets the map of explanatory values.- Returns:
- the value of the property, not null
-
-