Class JsonValueFormatter
#{...} expression into text.
CharSequence values are emitted as-is (bare, unquoted); numbers and
booleans use toString (integral doubles drop the .0); a Structure uses its plain-text
toString(); collections, maps and arrays are written as JSON (keys quoted, strings quoted only inside a
container, null). Any other object inside a container is written as its quoted
String.valueOf (there is no bean introspection here).
Nesting is capped at DEFAULT_MAX_DEPTH, each container at the configured element limit, and the whole
call at MAX_NODES written values (so a shared acyclic DAG cannot fan out exponentially). A container that
contains itself (a true cycle on the current path) is reported as a cycle. Beyond any limit the output is truncated
with a single "..." marker in lenient mode, or a VarResolverException is thrown in strict mode;
nothing here can overflow the stack.
JSON has no tokens for NaN or the infinities; inside containers they are written as the quoted strings
"NaN", "Infinity" and "-Infinity". A double or float that is integral is written without the
decimal point, so -0.0 is written as 0. The characters U+007F, U+2028 and U+2029 and all control
characters below U+0020 are escaped as \\uXXXX; lone surrogates are written as-is.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intDefault maximum container nesting depth.static final intMaximum number of values written by one call. -
Constructor Summary
ConstructorsConstructorDescriptionConstructor using the default collection limit, lenient.JsonValueFormatter(int maxSize, boolean strict) Constructor. -
Method Summary
-
Field Details
-
DEFAULT_MAX_DEPTH
Default maximum container nesting depth.- See Also:
-
MAX_NODES
Maximum number of values written by one call.- See Also:
-
-
Constructor Details
-
JsonValueFormatter
public JsonValueFormatter()Constructor using the default collection limit, lenient. -
JsonValueFormatter
Constructor.- Parameters:
maxSize- Maximum elements written per container.strict-true to throw instead of truncating when a limit is exceeded.
-
-
Method Details