io.nosqlbench.virtdata.api.templates.StringCompositor Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of virtdata-lib-curves4 Show documentation
Show all versions of virtdata-lib-curves4 Show documentation
Statistical sampling library for use in virtdata libraries, based
on apache commons math 4
package io.nosqlbench.virtdata.api.templates;
import io.nosqlbench.virtdata.api.ValuesBinder;
import io.nosqlbench.virtdata.api.Bindings;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.function.Function;
/**
* StringCompositor provides a way to build strings from a string template and provided values.
*
*
* The template is simply an array of string values, where odd indices represent token positions, and even indices represent
* literals. This version of the StringCompositor fetches data from the bindings only for the named fields in the template.
*
*/
public class StringCompositor implements ValuesBinder {
// protected static Pattern tokenPattern = Pattern.compile("(?(?([^{])+)?(?\\{(?[a-zA-Z0-9-_.]+)?\\})?)");
private String[] templateSegments;
private Function