Module swim.codec
Package swim.codec

Class 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 Detail

      • lineSeparator

        protected final String lineSeparator
      • isPretty

        protected final boolean isPretty
      • isStyled

        protected final boolean isStyled
    • Constructor Detail

      • OutputSettings

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

      • 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)
      • 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.
      • 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.