Class SimpleFormatProvider

java.lang.Object
eu.bandm.tools.format.spi.SimpleFormatProvider
All Implemented Interfaces:
FormatProvider<String>

public class SimpleFormatProvider extends Object implements FormatProvider<String>
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    append(List<? extends String> elems)
    Returns a compound format object that concatenates the given elements horizontally with absolute indentation.
    beneath(List<? extends String> elems)
    Returns a compound format object that concatenates the given elements vertically.
    beside(List<? extends String> elems)
    Returns a compound format object that concatenates the given elements horizontally with relative indentation.
    block(List<? extends String> elems)
    Returns a compound format object that concatenates the given elements first horizontally and then vertically.
    line(List<? extends String> elems)
    Returns a compound format object that concatenates the given elements either horizontally or vertically.
    Returns an atomic format object that displays the given string.
    space(int width)
    Returns an atomic format object that displays breakable whitespace.

    Methods inherited from class java.lang.Object

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

    • SimpleFormatProvider

      public SimpleFormatProvider()
  • Method Details

    • literal

      public String literal(String text)
      Description copied from interface: FormatProvider
      Returns an atomic format object that displays the given string.

      If the given string contains whitespace, that will not be considered for line breaks.

      Specified by:
      literal in interface FormatProvider<String>
      Parameters:
      text - the string to display
      Returns:
      an atomic format object that displays the given string
    • space

      public String space(int width)
      Description copied from interface: FormatProvider
      Returns an atomic format object that displays breakable whitespace.
      Specified by:
      space in interface FormatProvider<String>
      Parameters:
      width - the number of whitespace characters to display
      Returns:
      an atomic format object that displays breakable whitespace of the given width
    • append

      public String append(List<? extends String> elems)
      Description copied from interface: FormatProvider
      Returns a compound format object that concatenates the given elements horizontally with absolute indentation.
      Specified by:
      append in interface FormatProvider<String>
      Parameters:
      elems - the format subobjects to concatenate
      Returns:
      a concatenated compound format object
    • beside

      public String beside(List<? extends String> elems)
      Description copied from interface: FormatProvider
      Returns a compound format object that concatenates the given elements horizontally with relative indentation.
      Specified by:
      beside in interface FormatProvider<String>
      Parameters:
      elems - the format subobjects to concatenate
      Returns:
      a concatenated compound format object
    • beneath

      public String beneath(List<? extends String> elems)
      Description copied from interface: FormatProvider
      Returns a compound format object that concatenates the given elements vertically.
      Specified by:
      beneath in interface FormatProvider<String>
      Parameters:
      elems - the format subobjects to concatenate
      Returns:
      a concatenated compound format object
    • line

      public String line(List<? extends String> elems)
      Description copied from interface: FormatProvider
      Returns a compound format object that concatenates the given elements either horizontally or vertically.
      Specified by:
      line in interface FormatProvider<String>
      Parameters:
      elems - the format subobjects to concatenate
      Returns:
      a concatenated compound format object
    • block

      public String block(List<? extends String> elems)
      Description copied from interface: FormatProvider
      Returns a compound format object that concatenates the given elements first horizontally and then vertically.
      Specified by:
      block in interface FormatProvider<String>
      Parameters:
      elems - the format subobjects to concatenate
      Returns:
      a concatenated compound format object