- java.lang.Object
-
- io.virtdata.templates.StringMapCompositor
-
- All Implemented Interfaces:
ValuesArrayBinder<StringMapCompositor,java.lang.String>
public class StringMapCompositor extends java.lang.Object implements ValuesArrayBinder<StringMapCompositor,java.lang.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 Summary
Constructors Constructor Description StringMapCompositor(java.lang.String template)Create a string template which has positional tokens, in "{}" form.
-
Method Summary
Modifier and Type Method Description java.lang.StringbindValues(StringMapCompositor context, java.lang.Object[] values)Using context instance of type T, AKA the template, create and bind values to target object of type R
-
-
-
Method Detail
-
bindValues
public java.lang.String bindValues(StringMapCompositor context, java.lang.Object[] values)
Description copied from interface:ValuesArrayBinderUsing context instance of type T, AKA the template, create and bind values to target object of type R- Specified by:
bindValuesin interfaceValuesArrayBinder<StringMapCompositor,java.lang.String>- Parameters:
context- A context object that knows how to provide an instance of type Rvalues- An array of values which should be bound to the new R instance- Returns:
- The new result instance of R
-
-