public class Bindings extends Object
There are several ways to get generated data via this class. You must always provide a base input value. Fields can be accessed by parameter position or name. In some cases, you can provide an iterator stride in order to get data in bulk. In other cases, you can have setters called directly on your provided objects. See the detailed method docs for more information.
| Modifier and Type | Class and Description |
|---|---|
static interface |
Bindings.FieldSetter |
| Constructor and Description |
|---|
Bindings(BindingsTemplate template,
List<DataMapper<?>> dataMappers) |
| Modifier and Type | Method and Description |
|---|---|
Object |
get(int i,
long input)
Get a value for the data mapper in slot i
|
Object |
get(String name,
long input)
Get a value for the cached mapper name, using the name to mapper index cache.
|
Object[] |
getAll(long input)
Get a value from each data mapper in the bindings list
|
Map<String,Object> |
getAllMap(long input) |
List<Map<String,Object>> |
getIteratedMaps(long input,
int count)
Generate a list of maps over a range of inputs.
|
Map<String,Object> |
getIteratedSuffixMap(long input,
int count)
Generate a map containing the results from multiple iterations, suffixing
the keys in the map with the iterations from 0 to count-1.
|
Map<String,Object> |
getIteratedSuffixMap(long input,
int count,
String... fieldNames)
This is a version of the
setIteratedSuffixMap(Map, long, int, String[]) which creates
a new map for each call. |
LazyValuesMap |
getLazyMap(long input) |
BindingsTemplate |
getTemplate() |
void |
setAllFields(Bindings.FieldSetter fieldSetter,
long input)
Generate all the values named in the bind point names, then call the user-provided
field setter for each name and object generated.
|
void |
setAllFieldsIterated(Bindings.FieldSetter fieldSetter,
long input,
int count)
Generate all the values named in the bindings for a number of iterations, calling
a user-provided field setter for each name and object generated, with the
iteration number appended to the fieldName.
|
void |
setIteratedSuffixMap(Map<String,Object> donorMap,
long input,
long count)
Set the values in a provided map, with the bound names suffixed with
an internal iteration value.
|
void |
setMap(Map<String,Object> donorMap,
long cycle)
Generate all values in the bindings template, and set each of them in
the map according to their bind point name.
|
void |
setNamedFields(Bindings.FieldSetter fieldSetter,
long input,
String... fieldName)
Generate only the values named in fieldNames, and then call the user-provided
field setter for each name and object generated.
|
void |
setNamedFieldsIterated(Bindings.FieldSetter fieldSetter,
long input,
int count,
String... fieldName)
Generate all the values named in the bindings for a number of iterations, calling
a user-provided field setter for each name and object generated, with the
iteration number appended to the fieldName, but only for the named bindings.
|
void |
setSuffixedMap(Map<String,Object> donorMap,
long cycle,
String suffix)
Set the values in a provided map, with bound names suffixed with
some value.
|
String |
toString() |
void |
updateMap(Map<String,Object> donorMap,
long input)
Generate only the values which have matching keys in the provided
map according to their bind point names, and assign them to the
map under that name.
|
public Bindings(BindingsTemplate template, List<DataMapper<?>> dataMappers)
public Object[] getAll(long input)
input - The long value which the bound data mappers will use as in inputpublic BindingsTemplate getTemplate()
BindingsTemplate associated with this set of bindingspublic List<Map<String,Object>> getIteratedMaps(long input, int count)
For example, calling getIteratedMaps(5,3) with bindings named alpha and gamma might produce something like:
public Map<String,Object> getIteratedSuffixMap(long input, int count)
For example, calling getIteratedSuffixMap(5, 3) with generators named alpha and gamma might yield results like
public Map<String,Object> getIteratedSuffixMap(long input, int count, String... fieldNames)
setIteratedSuffixMap(Map, long, int, String[]) which creates
a new map for each call.input - The base input value for which the values should be generatedcount - The count of maps that should be added to the final mapfieldNames - The field names which are used to look up the functions in the bindingpublic Object get(int i, long input)
i - the data mapper slot, 0-indexedinput - the long input value which the bound data mapper will use as inputpublic Object get(String name, long input)
name - The field name in the data mapperinput - the long input value which the bound data mapper will use as an inputpublic void setMap(Map<String,Object> donorMap, long cycle)
donorMap - - a user-provided Map<String,Object>cycle - - the cycle for which to generate the valuespublic void setSuffixedMap(Map<String,Object> donorMap, long cycle, String suffix)
public void setIteratedSuffixMap(Map<String,Object> donorMap, long input, long count)
public void updateMap(Map<String,Object> donorMap, long input)
donorMap - - a user-provided Map<String,Object>input - - the input for which to generate the valuespublic void setNamedFields(Bindings.FieldSetter fieldSetter, long input, String... fieldName)
fieldSetter - user-provided object that implements Bindings.FieldSetter.input - the input for which to generate valuesfieldName - A varargs list of field names, or a String[] of names to setpublic void setNamedFieldsIterated(Bindings.FieldSetter fieldSetter, long input, int count, String... fieldName)
fieldSetter - user-provided object that implements Bindings.FieldSetterinput - the base input value for which the objects should be generatedcount - the number of iterations to generate values and names forfieldName - the field names for which to generate values and namespublic void setAllFields(Bindings.FieldSetter fieldSetter, long input)
fieldSetter - user-provided object that implements Bindings.FieldSetterinput - the input for which to generate valuespublic void setAllFieldsIterated(Bindings.FieldSetter fieldSetter, long input, int count)
fieldSetter - user-provided object that implements Bindings.FieldSetterinput - the base input value for which the objects should be generatedcount - the number of iterations to generate values and names forpublic LazyValuesMap getLazyMap(long input)
Copyright © 2018. All rights reserved.