Class TextFormat

java.lang.Object
io.sf.jclf.text.format.ObjectFormat
io.sf.jclf.text.format.TextFormat
All Implemented Interfaces:
Alignable

public class TextFormat extends ObjectFormat
Formats text.
  • Constructor Details

    • TextFormat

      public TextFormat()
  • Method Details

    • setFormat

      protected char setFormat(String format) throws SpecParsingException
      Description copied from class: ObjectFormat
      Sets the format of the object.
      Overrides:
      setFormat in class ObjectFormat
      Parameters:
      format - the format.
      Returns:
      the format type
      Throws:
      SpecParsingException - if the format contains unknown or wrong format specs.
    • setFlag

      protected boolean setFlag(char flag, int i)
      Description copied from class: ObjectFormat
      Sets the flags specific to this Class.
      Overrides:
      setFlag in class ObjectFormat
      Parameters:
      flag - the flag
      i - the position of the flag in the flags String
      Returns:
      true if the flag was understood, false otherwise.
    • format

      public String format(Object o)
      Description copied from class: ObjectFormat
      Formats an object according to the format specification set by setFormat.

      Must be overriden by subclasses.

      Specified by:
      format in class ObjectFormat
      Parameters:
      o - the object to be formatted.
      Returns:
      a string with the formatted object.
    • sample

      public Object sample()
      Description copied from class: ObjectFormat
      Produce a sample of this format.
      Specified by:
      sample in class ObjectFormat
      Returns:
      a String with a (more or less) random object appropriate to be formatted according to current format specifications.