public class Snippet
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
private class |
Snippet.Buffer
There are several buffers involved in the creation of a json string.
|
private static class |
Snippet.PassthroughWriter |
Modifier and Type | Field and Description |
---|---|
private javax.json.stream.JsonGeneratorFactory |
generatorFactory |
private int |
max |
Constructor and Description |
---|
Snippet(int max,
javax.json.stream.JsonGeneratorFactory generatorFactory)
This is the preferred approach to using Snippet in any context where
there is an existing JsonGeneratorFactory in scope.
|
Modifier and Type | Method and Description |
---|---|
static Snippet |
of(int max)
This factory should be used only in static or other scenarios were
there is no JsonGeneratorFactory instance in scope - ie external code.
|
static java.lang.String |
of(int max,
javax.json.JsonValue value)
Create a serialized json representation of the supplied
JsonValue, truncating the value to the specified max length.
|
java.lang.String |
of(javax.json.JsonValue value)
Create a serialized json representation of the supplied
JsonValue, truncating the value to the specified max length.
|
private final int max
private final javax.json.stream.JsonGeneratorFactory generatorFactory
public Snippet(int max, javax.json.stream.JsonGeneratorFactory generatorFactory)
max
- the maximum length of the serialized json produced via of()generatorFactory
- the JsonGeneratorFactory created by the userpublic java.lang.String of(javax.json.JsonValue value)
value
- the JsonValue to be serialized as json textpublic static Snippet of(int max)
max
- the maximum length of the serialized json produced via of()public static java.lang.String of(int max, javax.json.JsonValue value)
max
- the maximum length of the serialized json textvalue
- the JsonValue to be serialized as json textCopyright © 2014–2023 The Apache Software Foundation. All rights reserved.