public class JsonBuilder extends Object implements Closeable
Modifier and Type | Class and Description |
---|---|
static class |
JsonBuilder.SelectorType
CSS selector types
|
Modifier | Constructor and Description |
---|---|
protected |
JsonBuilder(Appendable writer)
Constructor with a default HTML config
|
protected |
JsonBuilder(Appendable writer,
HtmlConfig config)
Common constructor
|
Modifier and Type | Method and Description |
---|---|
void |
close() |
static JsonBuilder |
of(Appendable writer)
An object factory
|
static JsonBuilder |
of(HtmlConfig config,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
An object factory
|
static JsonBuilder |
of(HtmlConfig config,
javax.servlet.http.HttpServletResponse response)
An object factory
|
static JsonBuilder |
of(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
An object factory
|
static JsonBuilder |
of(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
HtmlConfig config)
Deprecated.
|
JsonBuilder |
write(CharSequence key,
CharSequence... values)
Write a key-value
|
JsonBuilder |
write(CharSequence key,
ValueProvider valueProvider)
Write a key-value
|
JsonBuilder |
write(String keyPrefix,
CharSequence key,
CharSequence... values)
Write a key-value
|
JsonBuilder |
write(String keyPrefix,
CharSequence key,
ValueProvider valueProvider) |
JsonBuilder |
writeClass(CharSequence elementId,
CharSequence... values)
Write the value for a CSS CLASS selector
|
JsonBuilder |
writeClass(CharSequence elementId,
ValueProvider valueProvider)
Write the value for a CSS CLASS selector
|
JsonBuilder |
writeClassObj(CharSequence elementId,
ObjectProvider objectProvider)
An experimental feature: write the value for a CSS CLASS selector
|
JsonBuilder |
writeId(CharSequence elementId,
CharSequence... values)
Write the value for a CSS ID selector
|
JsonBuilder |
writeId(CharSequence elementId,
ValueProvider valueProvider)
Write the value for a CSS ID selector
|
JsonBuilder |
writeIdObj(CharSequence elementId,
ObjectProvider objectProvider)
An experimental feature: write the value for a CSS ID selector
|
JsonBuilder |
writeObj(CharSequence key,
ObjectProvider objectProvider)
An experimental feature: write a key-object value
|
JsonBuilder |
writeObj(String keyPrefix,
CharSequence key,
ObjectProvider objectProvider)
An experimental feature: write key-object value
|
protected JsonBuilder(@Nonnull Appendable writer)
protected JsonBuilder(@Nonnull Appendable writer, HtmlConfig config)
public JsonBuilder writeId(@Nonnull CharSequence elementId, @Nullable CharSequence... values) throws IOException
elementId
- ID selectorvalues
- The text array to join.IOException
public JsonBuilder writeClass(@Nonnull CharSequence elementId, @Nullable CharSequence... values) throws IOException
elementId
- ID selectorvalues
- The text array to join.IOException
public JsonBuilder write(@Nonnull CharSequence key, @Nullable CharSequence... values) throws IOException
key
- A JSON keyvalues
- The text array to join.IOException
public JsonBuilder write(@Nonnull String keyPrefix, @Nonnull CharSequence key, @Nullable CharSequence... values) throws IOException
key
- A JSON keyvalues
- The text array to join.IOException
public JsonBuilder writeId(@Nonnull CharSequence elementId, @Nonnull ValueProvider valueProvider) throws IOException
elementId
- ID selectorvalueProvider
- A value providerIOException
public JsonBuilder writeClass(@Nonnull CharSequence elementId, @Nonnull ValueProvider valueProvider) throws IOException
elementId
- ID selectorvalueProvider
- A value providerIOException
public JsonBuilder write(@Nonnull CharSequence key, @Nonnull ValueProvider valueProvider) throws IOException
key
- A JSON keyvalueProvider
- A value providerIOException
public JsonBuilder write(@Nonnull String keyPrefix, @Nonnull CharSequence key, @Nonnull ValueProvider valueProvider) throws IOException
keyPrefix
- Key Prefixkey
- Main KeyvalueProvider
- A value providerIOException
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException
public JsonBuilder writeIdObj(@Nonnull CharSequence elementId, @Nonnull ObjectProvider objectProvider) throws IOException
elementId
- ID selectorobjectProvider
- A value providerIOException
public JsonBuilder writeClassObj(@Nonnull CharSequence elementId, @Nonnull ObjectProvider objectProvider) throws IOException
elementId
- ID selectorobjectProvider
- A value providerIOException
public JsonBuilder writeObj(@Nonnull CharSequence key, @Nonnull ObjectProvider objectProvider) throws IOException
key
- A JSON keyobjectProvider
- A value providerIOException
public JsonBuilder writeObj(@Nonnull String keyPrefix, @Nonnull CharSequence key, @Nonnull ObjectProvider objectProvider) throws IOException
keyPrefix
- Key Prefixkey
- Main KeyobjectProvider
- A value providerIOException
@Nonnull public static final JsonBuilder of(@Nonnull Appendable writer)
@Nonnull public static final JsonBuilder of(@Nonnull javax.servlet.http.HttpServletRequest request, @Nonnull javax.servlet.http.HttpServletResponse response) throws IllegalStateException, IOException
IllegalStateException
IOException
@Nonnull public static final JsonBuilder of(@Nonnull HtmlConfig config, @Nonnull javax.servlet.http.HttpServletResponse response) throws IllegalStateException, IOException
IllegalStateException
IOException
@Deprecated @Nonnull public static final JsonBuilder of(@Nullable javax.servlet.http.HttpServletRequest request, @Nonnull javax.servlet.http.HttpServletResponse response, @Nonnull HtmlConfig config) throws IllegalStateException, IOException
IllegalStateException
IOException
@Nonnull public static final JsonBuilder of(@Nonnull HtmlConfig config, @Nullable javax.servlet.http.HttpServletRequest request, @Nonnull javax.servlet.http.HttpServletResponse response) throws IllegalStateException, IOException
IllegalStateException
IOException
Copyright 2019-2022, Pavel Ponec