- java.lang.Object
-
- io.virtdata.templates.StringCompositor
-
- All Implemented Interfaces:
ValuesBinder<StringCompositor,java.lang.String>
public class StringCompositor extends java.lang.Object implements ValuesBinder<StringCompositor,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 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.
-
-
Constructor Summary
Constructors Constructor Description StringCompositor(java.lang.String template)Create a string template which has positional tokens, in "{}" form.StringCompositor(java.lang.String template, java.util.function.Function<java.lang.Object,java.lang.String> stringfunc)
-
Method Summary
Modifier and Type Method Description java.lang.StringbindValues(StringCompositor context, Bindings bindings, long cycle)Using context instance of type S, AKA the template, create and bind values to target object of type Rjava.util.List<java.lang.String>getBindPointNames()protected java.lang.String[]parseTemplate(java.lang.String template)
-
-
-
Constructor Detail
-
StringCompositor
public StringCompositor(java.lang.String template)
Create a string template which has positional tokens, in "{}" form.- Parameters:
template- The string template
-
StringCompositor
public StringCompositor(java.lang.String template, java.util.function.Function<java.lang.Object,java.lang.String> stringfunc)
-
-
Method Detail
-
parseTemplate
protected java.lang.String[] parseTemplate(java.lang.String template)
-
bindValues
public java.lang.String bindValues(StringCompositor context, Bindings bindings, long cycle)
Description copied from interface:ValuesBinderUsing context instance of type S, AKA the template, create and bind values to target object of type R- Specified by:
bindValuesin interfaceValuesBinder<StringCompositor,java.lang.String>- Parameters:
context- A context object that knows how to provide an instance of type Rbindings- A Bindings instance from which to draw the valuescycle- The cycle for which to generate the values- Returns:
- The new result instance of R
-
getBindPointNames
public java.util.List<java.lang.String> getBindPointNames()
-
-