Record Class MultiLineStringPrintFormat

java.lang.Object
java.lang.Record
org.approvej.print.MultiLineStringPrintFormat
Record Components:
printer - the printer implementing this format
All Implemented Interfaces:
Provider<PrintFormat<Object>>, PrintFormat<Object>, PrintFormatProvider<Object>

@NullMarked public record MultiLineStringPrintFormat(Printer<Object> printer) extends Record implements PrintFormat<Object>, PrintFormatProvider<Object>
A generic printer for Java Objects that prints their properties and values one per line.
  • Constructor Details

    • MultiLineStringPrintFormat

      public MultiLineStringPrintFormat()
      Default constructor using a MultiLineStringPrintFormat.MultiLineStringPrinter with no sorting.
    • MultiLineStringPrintFormat

      public MultiLineStringPrintFormat(Printer<Object> printer)
      Creates an instance of a MultiLineStringPrintFormat record class.
      Parameters:
      printer - the value for the printer record component
  • Method Details

    • sorted

      public MultiLineStringPrintFormat sorted()
      Sort the printed object's properties alphabetically by their name. By default, field-backed properties are printed in declaration order, followed by getter-only properties alphabetically.
      Returns:
      a copy of this sorting all properties by name
    • alias

      public String alias()
      Description copied from interface: Provider
      Returns the alias that can be used to reference this provider in configuration.

      For example, "json" or "yaml" for print formats, or "none" or "automatic" for reviewers.

      Specified by:
      alias in interface Provider<PrintFormat<Object>>
      Returns:
      the alias for this provider
    • create

      public PrintFormat<Object> create()
      Description copied from interface: Provider
      Creates a new instance of the component.

      When implemented by the component class itself, this typically returns a new instance of the same class via its no-argument constructor.

      Specified by:
      create in interface Provider<PrintFormat<Object>>
      Returns:
      a new instance of the component
    • multiLineString

      public static MultiLineStringPrintFormat multiLineString()
      Returns:
      a new MultiLineStringPrintFormat
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • printer

      public Printer<Object> printer()
      Returns the value of the printer record component.
      Specified by:
      printer in interface PrintFormat<Object>
      Returns:
      the value of the printer record component