public final class ExplainMapBuilder extends Object
This is a mutable builder for ExplainMap that must be used from a single thread.
| Modifier and Type | Method and Description |
|---|---|
<R extends List<?>> |
addListEntry(ExplainKey<R> key,
Consumer<ExplainMapBuilder> consumer)
Adds a list entry using a consumer callback function.
|
<R extends List<?>> |
addListEntryWithIndex(ExplainKey<R> key,
Consumer<ExplainMapBuilder> consumer)
Adds a list entry using a consumer callback function, including the list index.
|
ExplainMap |
build()
Builds the map.
|
<R extends List<?>> |
closeListEntry(ExplainKey<R> key)
Closes the currently open list.
|
<R extends List<?>> |
openListEntry(ExplainKey<R> key)
Opens a list entry to be populated.
|
<R> ExplainMapBuilder |
put(ExplainKey<R> key,
R value)
Puts a single value into the map.
|
public <R extends List<?>> ExplainMapBuilder openListEntry(ExplainKey<R> key)
This returns the builder for the new list entry. If the list does not exist, it is created and the first entry added. If the list has already been created, the entry is appended.
Once opened, the child builder resulting from this method must be used.
The method closeListEntry(ExplainKey) must be used to close the
child and receive an instance of the parent back again.
R - the type of the valuekey - the list key to openpublic <R extends List<?>> ExplainMapBuilder closeListEntry(ExplainKey<R> key)
This returns the parent builder.
R - the type of the valuekey - the list key to closepublic <R extends List<?>> ExplainMapBuilder addListEntry(ExplainKey<R> key, Consumer<ExplainMapBuilder> consumer)
This is an alternative to using openListEntry(ExplainKey) and
closeListEntry(ExplainKey) directly.
The consumer function receives the child builder and must add data to it.
R - the type of the valuekey - the list key to openconsumer - the consumer that receives the list entry builder and adds to itpublic <R extends List<?>> ExplainMapBuilder addListEntryWithIndex(ExplainKey<R> key, Consumer<ExplainMapBuilder> consumer)
This is an alternative to using openListEntry(ExplainKey) and
closeListEntry(ExplainKey) directly.
The consumer function receives the child builder and must add data to it.
R - the type of the valuekey - the list key to openconsumer - the consumer that receives the list entry builder and adds to itpublic <R> ExplainMapBuilder put(ExplainKey<R> key, R value)
If the key already exists, the value will be replaced.
R - the type of the valuekey - the key to addvalue - the value to addpublic ExplainMap build()
Copyright 2009-Present by OpenGamma Inc. and individual contributors
Apache v2 licensed
Additional documentation can be found at strata.opengamma.io.