public static class AsyncJSON.Factory
extends java.lang.Object
The factory that creates AsyncJSON instances.
The factory can be configured with custom JSON.Convertor
s,
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 fromnull
public 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.Person
convertor
- 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.Convertor
JSON.Convertor
associated with the class name, or null
public 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.Convertor
JSON.Convertor
associated with the class name, or null
Copyright © 1995–2021 Webtide. All rights reserved.