Record Class JsonTokenWriter.Settings

java.lang.Object
java.lang.Record
org.apache.juneau.marshall.json.JsonTokenWriter.Settings
Record Components:
useWhitespace - If true, emit indented output with newlines.
maxIndent - Maximum indentation depth when useWhitespace is enabled. Levels beyond this depth are emitted compactly.
quoteChar - The quote character used for strings and field names. Typically '"' (RFC-8259) but may be '\'' for JSON5-style output.
escapeSolidus - If true, forward slashes (/) are escaped as \/.
trimStrings - If true, leading/trailing whitespace is trimmed from emitted TokenType.VALUE_STRING and TokenType.FIELD_NAME values.
simpleAttrs - If true, field names are emitted unquoted when they are valid JavaScript identifiers and not reserved words. This is the JSON5 "lax attribute" mode; strict RFC-8259 JSON keeps this false.
walk - The walk options used by object(Object) when walking a value graph.
disableObject - If true, object(Object) throws UnsupportedOperationException with a format-specific message. Used by formats whose serialize() produces non-standard JSON (e.g. JsonSchemaSerializer, JcsSerializer) where the cursor's POJO walker would emit ordinary JSON instead of the format's special form.
Enclosing class:
JsonTokenWriter

public static record JsonTokenWriter.Settings(boolean useWhitespace, int maxIndent, char quoteChar, boolean escapeSolidus, boolean trimStrings, boolean simpleAttrs, PojoWalker.Options walk, boolean disableObject) extends Record
Output-formatting settings honored by JsonTokenWriter.

This is the structurally-applicable subset of JsonSerializer.Builder. Properties that operate on the POJO path (addBeanTypes, keepNullProperties, trimEmptyMaps, trimEmptyCollections, sortMaps, sortCollections, object swaps, and @Schema annotations) have no effect on the token surface and are deliberately not represented here.

  • Field Details

  • Constructor Details

    • Settings

      public Settings(boolean useWhitespace, int maxIndent, char quoteChar, boolean escapeSolidus, boolean trimStrings, boolean simpleAttrs, PojoWalker.Options walk, boolean disableObject)
      Creates an instance of a Settings record class.
      Parameters:
      useWhitespace - the value for the useWhitespace record component
      maxIndent - the value for the maxIndent record component
      quoteChar - the value for the quoteChar record component
      escapeSolidus - the value for the escapeSolidus record component
      trimStrings - the value for the trimStrings record component
      simpleAttrs - the value for the simpleAttrs record component
      walk - the value for the walk record component
      disableObject - the value for the disableObject record component
  • Method Details

    • 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 '=='.
      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.
    • useWhitespace

      public boolean useWhitespace()
      Returns the value of the useWhitespace record component.
      Returns:
      the value of the useWhitespace record component
    • maxIndent

      public int maxIndent()
      Returns the value of the maxIndent record component.
      Returns:
      the value of the maxIndent record component
    • quoteChar

      public char quoteChar()
      Returns the value of the quoteChar record component.
      Returns:
      the value of the quoteChar record component
    • escapeSolidus

      public boolean escapeSolidus()
      Returns the value of the escapeSolidus record component.
      Returns:
      the value of the escapeSolidus record component
    • trimStrings

      public boolean trimStrings()
      Returns the value of the trimStrings record component.
      Returns:
      the value of the trimStrings record component
    • simpleAttrs

      public boolean simpleAttrs()
      Returns the value of the simpleAttrs record component.
      Returns:
      the value of the simpleAttrs record component
    • walk

      Returns the value of the walk record component.
      Returns:
      the value of the walk record component
    • disableObject

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