Class Template

java.lang.Object
io.nosqlbench.virtdata.library.basics.shared.from_long.to_string.Template
All Implemented Interfaces:
LongFunction<String>
Direct Known Subclasses:
FullNames, JoinTemplate

public class Template extends Object implements LongFunction<String>
Creates a template function which will yield a string which fits the template provided, with all occurrences of {} substituted pair-wise with the result of the provided functions. The number of {} entries in the template must strictly match the number of functions or an error will be thrown. If you need to include single quotes or other special characters, you may use a backslash "\" in your template. The objects passed must be functions of any of the following types:
  • LongUnaryOperator
  • IntUnaryOperator
  • DoubleUnaryOperator
  • LongFunction
  • IntFunction
  • DoubleFunction
  • Function<Long,?>

The result of applying the input value to any of these functions is converted to a String and then stitched together according to the template provided.

  • Constructor Details

    • Template

      public Template(String template, Object... funcs)
    • Template

      public Template(boolean truncate, String template, Object... funcs)
    • Template

      public Template(LongUnaryOperator iterOp, String template, LongFunction<?>... funcs)
      If an operator is provided, it is used to change the function input value in an additional way before each function.
      Parameters:
      iterOp - A pre-generation value mapping function
      template - A string template containing
      {}
      anchors
      funcs - A varargs length of LongFunctions of any output type
  • Method Details