Class 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.String bindValues​(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
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • StringMapCompositor

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

      • bindValues

        public java.lang.String bindValues​(StringMapCompositor context,
                                           java.lang.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,​java.lang.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