Record Class EncodeOptions

java.lang.Object
java.lang.Record
dev.toonformat.jtoon.EncodeOptions
Record Components:
indent - Number of spaces per indentation level (default: 2)
delimiter - Delimiter to use for tabular array rows and inline primitive arrays (default: COMMA)
lengthMarker - Optional marker to prefix array lengths in headers. When true, arrays render as [#N] instead of [N] (default: false)

public record EncodeOptions(int indent, Delimiter delimiter, boolean lengthMarker) extends Record
Configuration options for encoding data to JToon format.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final EncodeOptions
    Default encoding options: 2 spaces indent, comma delimiter, no length marker
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates EncodeOptions with default values.
    EncodeOptions(int indent, Delimiter delimiter, boolean lengthMarker)
    Creates an instance of a EncodeOptions record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the value of the delimiter record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    int
    Returns the value of the indent record component.
    boolean
    Returns the value of the lengthMarker record component.
    final String
    Returns a string representation of this record class.
    Creates EncodeOptions with custom delimiter, using default indent and length marker.
    withIndent(int indent)
    Creates EncodeOptions with custom indent, using default delimiter and length marker.
    withLengthMarker(boolean lengthMarker)
    Creates EncodeOptions with custom length marker, using default indent and delimiter.

    Methods inherited from class Object

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

    • DEFAULT

      public static final EncodeOptions DEFAULT
      Default encoding options: 2 spaces indent, comma delimiter, no length marker
  • Constructor Details

    • EncodeOptions

      public EncodeOptions()
      Creates EncodeOptions with default values.
    • EncodeOptions

      public EncodeOptions(int indent, Delimiter delimiter, boolean lengthMarker)
      Creates an instance of a EncodeOptions record class.
      Parameters:
      indent - the value for the indent record component
      delimiter - the value for the delimiter record component
      lengthMarker - the value for the lengthMarker record component
  • Method Details

    • withIndent

      public static EncodeOptions withIndent(int indent)
      Creates EncodeOptions with custom indent, using default delimiter and length marker.
      Parameters:
      indent - number of spaces per indentation level
      Returns:
      a new EncodeOptions instance with the specified indent
    • withDelimiter

      public static EncodeOptions withDelimiter(Delimiter delimiter)
      Creates EncodeOptions with custom delimiter, using default indent and length marker.
      Parameters:
      delimiter - the delimiter to use for tabular arrays and inline primitive arrays
      Returns:
      a new EncodeOptions instance with the specified delimiter
    • withLengthMarker

      public static EncodeOptions withLengthMarker(boolean lengthMarker)
      Creates EncodeOptions with custom length marker, using default indent and delimiter.
      Parameters:
      lengthMarker - whether to include the # marker before array lengths
      Returns:
      a new EncodeOptions instance with the specified length marker setting
    • 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. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      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.
    • indent

      public int indent()
      Returns the value of the indent record component.
      Returns:
      the value of the indent record component
    • delimiter

      public Delimiter delimiter()
      Returns the value of the delimiter record component.
      Returns:
      the value of the delimiter record component
    • lengthMarker

      public boolean lengthMarker()
      Returns the value of the lengthMarker record component.
      Returns:
      the value of the lengthMarker record component