public static class AsyncJSON.Factory
extends java.lang.Object
The factory that creates AsyncJSON instances.
The factory can be configured with custom JSON.Convertors,
and with cached strings that will not be allocated if they can
be looked up from the cache.
| Constructor and Description |
|---|
Factory() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
cache(java.lang.String value) |
protected java.lang.String |
cached(java.nio.ByteBuffer buffer)
Attempts to return a cached string from the buffer bytes.
|
JSON.Convertor |
getConvertor(java.lang.String className)
Returns the
JSON.Convertor associated with the given class name, if any. |
boolean |
isDetailedParseException() |
AsyncJSON |
newAsyncJSON() |
void |
putConvertor(java.lang.String className,
JSON.Convertor convertor)
Associates the given
JSON.Convertor to the given class name. |
JSON.Convertor |
removeConvertor(java.lang.String className)
Removes the
JSON.Convertor associated with the given class name. |
void |
setDetailedParseException(boolean detailedParseException) |
public boolean isDetailedParseException()
public void setDetailedParseException(boolean detailedParseException)
detailedParseException - whether a parse failure should report the whole JSON string or just the last chunkpublic boolean cache(java.lang.String value)
value - the string to cacheprotected java.lang.String cached(java.nio.ByteBuffer buffer)
Attempts to return a cached string from the buffer bytes.
In case of a cache hit, the string is returned and the buffer position updated.
In case of cache miss, null is returned and the buffer
position is left unaltered.
buffer - the buffer to lookup the string fromnullpublic AsyncJSON newAsyncJSON()
public void putConvertor(java.lang.String className,
JSON.Convertor convertor)
Associates the given JSON.Convertor to the given class name.
className - the domain class name such as com.acme.Personconvertor - the JSON.Convertor that converts Map to domain objectspublic JSON.Convertor removeConvertor(java.lang.String className)
Removes the JSON.Convertor associated with the given class name.
className - the class name associated with the JSON.ConvertorJSON.Convertor associated with the class name, or nullpublic JSON.Convertor getConvertor(java.lang.String className)
Returns the JSON.Convertor associated with the given class name, if any.
className - the class name associated with the JSON.ConvertorJSON.Convertor associated with the class name, or nullCopyright © 1995–2021 Webtide. All rights reserved.