Class StringMapCompositor

java.lang.Object
io.nosqlbench.virtdata.core.templates.StringMapCompositor
All Implemented Interfaces:
ValuesArrayBinder<StringMapCompositor,String>

public class StringMapCompositor extends Object implements ValuesArrayBinder<StringMapCompositor,String>
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 literals, and even indices represent token positions. If the token positions contains words, then these can be used as keys for looking up values in an associated map. If not, then values are simply positional, in which case simple numerals are used as indices for debugging purposes, although they are not referenced during string interpolation.

  • Constructor Details

    • StringMapCompositor

      public StringMapCompositor(String template)
      Create a string template which has positional tokens, in "{}" form.
      Parameters:
      template - The string template
  • Method Details

    • bindValues

      public String bindValues(StringMapCompositor context, Object[] values)
      Description copied from interface: ValuesArrayBinder
      Using context instance of type T, AKA the template, create and bind values to target object of type R
      Specified by:
      bindValues in interface ValuesArrayBinder<StringMapCompositor,String>
      Parameters:
      context - A context object that knows how to provide an instance of type R
      values - An array of values which should be bound to the new R instance
      Returns:
      The new result instance of R