java.lang.Object
java.lang.Record
net.luis.utils.io.data.json.JsonConfig
- Record Components:
strict
- Whether to use strict json parsing when reading (read-only)prettyPrint
- Whether to pretty print the json (write-only)indent
- The string to use for indentation (write-only)simplifyArrays
- Whether to simplify json arrays (write-only)maxArraySimplificationSize
- The maximum size of a json array to simplify (write-only)simplifyObjects
- Whether to simplify json objects (write-only)maxObjectSimplificationSize
- The maximum size of a json object to simplify (write-only)charset
- The charset to use for reading and writing
public record JsonConfig(@ReadOnly boolean strict, @WriteOnly boolean prettyPrint, @WriteOnly("prettyPrint") @NotNull String indent, @WriteOnly("prettyPrint") boolean simplifyArrays, @WriteOnly("simplifyArrays") int maxArraySimplificationSize, @WriteOnly("prettyPrint") boolean simplifyObjects, @WriteOnly("simplifyObjects") int maxObjectSimplificationSize, @NotNull Charset charset)
extends Record
Configuration for reading and writing json elements.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final @NotNull Charset
The field for thecharset
record component.static final JsonConfig
The default json configuration.
Strict: true
Pretty print: true
Indent: "\t"
Simplify arrays: true
Max array simplification size: 10
Simplify objects: true
Max object simplification size: 1
Charset: UTF-8private final @NotNull String
The field for theindent
record component.private final int
The field for themaxArraySimplificationSize
record component.private final int
The field for themaxObjectSimplificationSize
record component.private final boolean
The field for theprettyPrint
record component.private final boolean
The field for thesimplifyArrays
record component.private final boolean
The field for thesimplifyObjects
record component.private final boolean
The field for thestrict
record component. -
Constructor Summary
ConstructorsConstructorDescriptionJsonConfig
(boolean strict, boolean prettyPrint, @NotNull String indent, boolean simplifyArrays, int maxArraySimplificationSize, boolean simplifyObjects, int maxObjectSimplificationSize, @NotNull Charset charset) Constructs a new json configuration. -
Method Summary
Modifier and TypeMethodDescription@NotNull Charset
charset()
Returns the value of thecharset
record component.final boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.@NotNull String
indent()
Returns the value of theindent
record component.int
Returns the value of themaxArraySimplificationSize
record component.int
Returns the value of themaxObjectSimplificationSize
record component.boolean
Returns the value of theprettyPrint
record component.boolean
Returns the value of thesimplifyArrays
record component.boolean
Returns the value of thesimplifyObjects
record component.boolean
strict()
Returns the value of thestrict
record component.final String
toString()
Returns a string representation of this record class.
-
Field Details
-
strict
private final boolean strictThe field for thestrict
record component. -
prettyPrint
private final boolean prettyPrintThe field for theprettyPrint
record component. -
indent
The field for theindent
record component. -
simplifyArrays
private final boolean simplifyArraysThe field for thesimplifyArrays
record component. -
maxArraySimplificationSize
private final int maxArraySimplificationSizeThe field for themaxArraySimplificationSize
record component. -
simplifyObjects
private final boolean simplifyObjectsThe field for thesimplifyObjects
record component. -
maxObjectSimplificationSize
private final int maxObjectSimplificationSizeThe field for themaxObjectSimplificationSize
record component. -
charset
The field for thecharset
record component. -
DEFAULT
The default json configuration.
Strict: true
Pretty print: true
Indent: "\t"
Simplify arrays: true
Max array simplification size: 10
Simplify objects: true
Max object simplification size: 1
Charset: UTF-8
-
-
Constructor Details
-
JsonConfig
public JsonConfig(boolean strict, boolean prettyPrint, @NotNull @NotNull String indent, boolean simplifyArrays, int maxArraySimplificationSize, boolean simplifyObjects, int maxObjectSimplificationSize, @NotNull @NotNull Charset charset) Constructs a new json configuration.- Parameters:
strict
- Whether to use strict json parsing when reading (read-only)prettyPrint
- Whether to pretty print the json (write-only)indent
- The string to use for indentation (write-only)simplifyArrays
- Whether to simplify json arrays (write-only)maxArraySimplificationSize
- The maximum size of a json array to simplify (write-only)simplifyObjects
- Whether to simplify json objects (write-only)maxObjectSimplificationSize
- The maximum size of a json object to simplify (write-only)charset
- The charset to use for reading and writing- Throws:
NullPointerException
- If the indent or charset is nullIllegalArgumentException
- If the max array or object simplification size is less than 1 and the corresponding simplification is enabled
-
-
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
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. -
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 '=='. -
strict
public boolean strict()Returns the value of thestrict
record component.- Returns:
- the value of the
strict
record component
-
prettyPrint
public boolean prettyPrint()Returns the value of theprettyPrint
record component.- Returns:
- the value of the
prettyPrint
record component
-
indent
Returns the value of theindent
record component.- Returns:
- the value of the
indent
record component
-
simplifyArrays
public boolean simplifyArrays()Returns the value of thesimplifyArrays
record component.- Returns:
- the value of the
simplifyArrays
record component
-
maxArraySimplificationSize
public int maxArraySimplificationSize()Returns the value of themaxArraySimplificationSize
record component.- Returns:
- the value of the
maxArraySimplificationSize
record component
-
simplifyObjects
public boolean simplifyObjects()Returns the value of thesimplifyObjects
record component.- Returns:
- the value of the
simplifyObjects
record component
-
maxObjectSimplificationSize
public int maxObjectSimplificationSize()Returns the value of themaxObjectSimplificationSize
record component.- Returns:
- the value of the
maxObjectSimplificationSize
record component
-
charset
Returns the value of thecharset
record component.- Returns:
- the value of the
charset
record component
-