Module swim.codec
Package swim.codec

Class OutputSettings

java.lang.Object
swim.codec.OutputSettings
All Implemented Interfaces:
Debug

public class OutputSettings extends Object implements Debug
Output production parameters. OutputSettings provide contextual configuration parameters to output producers, such as Writers. Uses include enabling pretty printing and styling generated output. Subclasses can provide additional parameters understood by specialized output producers.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final boolean
     
    protected final boolean
     
    protected final String
     
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    OutputSettings(String lineSeparator, boolean isPretty, boolean isStyled)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected boolean
     
    protected OutputSettings
    copy(String lineSeparator, boolean isPretty, boolean isStyled)
     
    static final OutputSettings
    create(String lineSeparator, boolean isPretty, boolean isStyled)
    Returns OutputSettings configured with the given lineSeparator, pretty printing enabled if isPretty is true, and styling enabled if isStyled is true.
    <T> Output<T>
    debug(Output<T> output)
    Writes a developer readable, debug-formatted string representation of this object to output.
    boolean
    equals(Object other)
     
    int
     
    final boolean
    Returns true if output producers should pretty print their output, when possible.
    isPretty(boolean isPretty)
    Returns a copy of these settings with the given isPretty flag.
    final boolean
    Returns true if output producers should style their output, when possible.
    isStyled(boolean isStyled)
    Returns a copy of these settings with the given isStyled flag.
    final String
    Returns the code point sequence used to separate lines of text.
    lineSeparator(String lineSeparator)
    Returns a copy of these settings with the given lineSeparator.
    static final OutputSettings
    Returns OutputSettings configured with the system line separator, pretty printing enabled, and styling disabled.
    static final OutputSettings
    Returns OutputSettings configured with the system line separator, pretty printing enabled, and styling enabled.
    static final OutputSettings
    Returns OutputSettings configured with the system line separator, pretty printing disabled, and styling disabled.
    static final OutputSettings
    Returns OutputSettings configured with the system line separator, pretty printing disabled, and styling enabled.
     

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • lineSeparator

      protected final String lineSeparator
    • isPretty

      protected final boolean isPretty
    • isStyled

      protected final boolean isStyled
  • Constructor Details

    • OutputSettings

      protected OutputSettings(String lineSeparator, boolean isPretty, boolean isStyled)
  • Method Details

    • lineSeparator

      public final String lineSeparator()
      Returns the code point sequence used to separate lines of text. Defaults to the operating system's line separator.
    • lineSeparator

      public OutputSettings lineSeparator(String lineSeparator)
      Returns a copy of these settings with the given lineSeparator.
    • isPretty

      public final boolean isPretty()
      Returns true if output producers should pretty print their output, when possible.
    • isPretty

      public OutputSettings isPretty(boolean isPretty)
      Returns a copy of these settings with the given isPretty flag.
    • isStyled

      public final boolean isStyled()
      Returns true if output producers should style their output, when possible.
    • isStyled

      public OutputSettings isStyled(boolean isStyled)
      Returns a copy of these settings with the given isStyled flag.
    • copy

      protected OutputSettings copy(String lineSeparator, boolean isPretty, boolean isStyled)
    • canEqual

      protected boolean canEqual(Object other)
    • equals

      public boolean equals(Object other)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • debug

      public <T> Output<T> debug(Output<T> output)
      Description copied from interface: Debug
      Writes a developer readable, debug-formatted string representation of this object to output.
      Specified by:
      debug in interface Debug
      Returns:
      the continuation of the output.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • standard

      public static final OutputSettings standard()
      Returns OutputSettings configured with the system line separator, pretty printing disabled, and styling disabled.
    • pretty

      public static final OutputSettings pretty()
      Returns OutputSettings configured with the system line separator, pretty printing enabled, and styling disabled.
    • styled

      public static final OutputSettings styled()
      Returns OutputSettings configured with the system line separator, pretty printing disabled, and styling enabled.
    • prettyStyled

      public static final OutputSettings prettyStyled()
      Returns OutputSettings configured with the system line separator, pretty printing enabled, and styling enabled.
    • create

      public static final OutputSettings create(String lineSeparator, boolean isPretty, boolean isStyled)
      Returns OutputSettings configured with the given lineSeparator, pretty printing enabled if isPretty is true, and styling enabled if isStyled is true.