Package org.apache.juneau.marshall.json
Record Class JsonTokenWriter.Settings
java.lang.Object
java.lang.Record
org.apache.juneau.marshall.json.JsonTokenWriter.Settings
- Record Components:
useWhitespace- Iftrue , emit indented output with newlines.maxIndent- Maximum indentation depth whenuseWhitespace 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- Iftrue , forward slashes (/ ) are escaped as\/ .trimStrings- Iftrue , leading/trailing whitespace is trimmed from emittedTokenType.VALUE_STRINGandTokenType.FIELD_NAMEvalues.simpleAttrs- Iftrue , 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 thisfalse .walk- Thewalk optionsused byobject(Object)when walking a value graph.disableObject- Iftrue ,object(Object)throwsUnsupportedOperationExceptionwith a format-specific message. Used by formats whoseserialize()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 (@Schema annotations) have no effect on the token surface and are
deliberately not represented here.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final JsonTokenWriter.SettingsDefault canonical setting: compact RFC-8259 JSON, double-quoted, no trimming. -
Constructor Summary
ConstructorsConstructorDescriptionSettings(boolean useWhitespace, int maxIndent, char quoteChar, boolean escapeSolidus, boolean trimStrings, boolean simpleAttrs, PojoWalker.Options walk, boolean disableObject) Creates an instance of aSettingsrecord class. -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns the value of thedisableObjectrecord component.final booleanIndicates whether some other object is "equal to" this one.booleanReturns the value of theescapeSolidusrecord component.final inthashCode()Returns a hash code value for this object.intReturns the value of themaxIndentrecord component.charReturns the value of thequoteCharrecord component.booleanReturns the value of thesimpleAttrsrecord component.final StringtoString()Returns a string representation of this record class.booleanReturns the value of thetrimStringsrecord component.booleanReturns the value of theuseWhitespacerecord component.walk()Returns the value of thewalkrecord component.
-
Field Details
-
DEFAULT
Default canonical setting: compact RFC-8259 JSON, double-quoted, no trimming.
-
-
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 aSettingsrecord class.- Parameters:
useWhitespace- the value for theuseWhitespacerecord componentmaxIndent- the value for themaxIndentrecord componentquoteChar- the value for thequoteCharrecord componentescapeSolidus- the value for theescapeSolidusrecord componenttrimStrings- the value for thetrimStringsrecord componentsimpleAttrs- the value for thesimpleAttrsrecord componentwalk- the value for thewalkrecord componentdisableObject- the value for thedisableObjectrecord component
-
-
Method Details
-
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. -
hashCode
Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
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 withObjects::equals(Object,Object); primitive components are compared with '=='. -
useWhitespace
Returns the value of theuseWhitespacerecord component.- Returns:
- the value of the
useWhitespacerecord component
-
maxIndent
Returns the value of themaxIndentrecord component.- Returns:
- the value of the
maxIndentrecord component
-
quoteChar
Returns the value of thequoteCharrecord component.- Returns:
- the value of the
quoteCharrecord component
-
escapeSolidus
Returns the value of theescapeSolidusrecord component.- Returns:
- the value of the
escapeSolidusrecord component
-
trimStrings
Returns the value of thetrimStringsrecord component.- Returns:
- the value of the
trimStringsrecord component
-
simpleAttrs
Returns the value of thesimpleAttrsrecord component.- Returns:
- the value of the
simpleAttrsrecord component
-
walk
Returns the value of thewalkrecord component.- Returns:
- the value of the
walkrecord component
-
disableObject
Returns the value of thedisableObjectrecord component.- Returns:
- the value of the
disableObjectrecord component
-