|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.dslplatform.json.DslJson.Settings<TContext>
TContext - DslJson contextpublic static class DslJson.Settings<TContext>
Configuration for DslJson options. By default key cache is enabled. Everything else is not configured. To load `META-INF/services` call `includeServiceLoader()`
| Constructor Summary | |
|---|---|
DslJson.Settings()
|
|
| Method Summary | |
|---|---|
DslJson.Settings<TContext> |
allowArrayFormat(boolean allowArrayFormat)
Some encoders/decoders support writing objects in array format. |
DslJson.Settings<TContext> |
doublePrecision(JsonReader.DoublePrecision precision)
By default doubles are not deserialized into an exact value in some rare edge cases. |
DslJson.Settings<TContext> |
errorInfo(JsonReader.ErrorInfo errorInfo)
By default doubles are not deserialized into an exact value in some rare edge cases. |
DslJson.Settings<TContext> |
fallbackTo(DslJson.Fallback<TContext> fallback)
Deprecated. |
DslJson.Settings<TContext> |
includeServiceLoader()
Load converters using thread local ClassLoader. |
DslJson.Settings<TContext> |
includeServiceLoader(ClassLoader loader)
Load converters using provided `ClassLoader` instance Will scan through `META-INF/services/com.dslplatform.json.Configuration` file and register implementation during startup. |
DslJson.Settings<TContext> |
limitDigitsBuffer(int size)
Specify maximum allowed size for digits buffer. |
DslJson.Settings<TContext> |
limitStringBuffer(int size)
Specify maximum allowed size for string buffer. |
DslJson.Settings<TContext> |
resolveBinder(DslJson.ConverterFactory<? extends JsonReader.BindObject> binder)
DslJson will iterate over converter factories when requested type is unknown. |
DslJson.Settings<TContext> |
resolveReader(DslJson.ConverterFactory<? extends JsonReader.ReadObject> reader)
DslJson will iterate over converter factories when requested type is unknown. |
DslJson.Settings<TContext> |
resolveWriter(DslJson.ConverterFactory<? extends JsonWriter.WriteObject> writer)
DslJson will iterate over converter factories when requested type is unknown. |
DslJson.Settings<TContext> |
skipDefaultValues(boolean omitDefaults)
DslJson can exclude some properties from resulting JSON which it can reconstruct fully from schema information. |
DslJson.Settings<TContext> |
unknownNumbers(JsonReader.UnknownNumberParsing unknownNumbers)
When processing JSON without a schema numbers can be deserialized in various ways: - as longs and decimals - as longs and doubles - as decimals only - as doubles only Default is as long and BigDecimal |
DslJson.Settings<TContext> |
useKeyCache(StringCache keyCache)
Use specific key cache implementation. |
DslJson.Settings<TContext> |
useStringValuesCache(StringCache valuesCache)
Use specific string values cache implementation. |
DslJson.Settings<TContext> |
with(Configuration conf)
Configure DslJson with custom Configuration during startup. |
DslJson.Settings<TContext> |
withContext(TContext context)
Pass in context for DslJson. |
DslJson.Settings<TContext> |
withJavaConverters(boolean javaSpecifics)
Enable converters for Java specific types (Graphics API) not available on Android. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public DslJson.Settings()
| Method Detail |
|---|
public DslJson.Settings<TContext> withContext(@Nullable
TContext context)
context - context propagated to JsonReaders
public DslJson.Settings<TContext> withJavaConverters(boolean javaSpecifics)
javaSpecifics - should register Java specific converters
@Deprecated
public DslJson.Settings<TContext> fallbackTo(@Nullable
DslJson.Fallback<TContext> fallback)
fallback - how to handle unsupported type
public DslJson.Settings<TContext> skipDefaultValues(boolean omitDefaults)
omitDefaults - should exclude default values from resulting JSON
public DslJson.Settings<TContext> allowArrayFormat(boolean allowArrayFormat)
allowArrayFormat - allow serialization via array format
public DslJson.Settings<TContext> useKeyCache(@Nullable
StringCache keyCache)
To disable key cache, provide null for it.
keyCache - which key cache to use
public DslJson.Settings<TContext> useStringValuesCache(@Nullable
StringCache valuesCache)
To support memory restricted scenarios where there is limited number of string values, values cache can be used.
Not every "JSON string" will use this cache... eg UUID, LocalDate don't create an instance of string and therefore don't use this cache.
valuesCache - which values cache to use
public DslJson.Settings<TContext> resolveWriter(DslJson.ConverterFactory<? extends JsonWriter.WriteObject> writer)
writer - registered writer factory
public DslJson.Settings<TContext> resolveReader(DslJson.ConverterFactory<? extends JsonReader.ReadObject> reader)
reader - registered reader factory
public DslJson.Settings<TContext> resolveBinder(DslJson.ConverterFactory<? extends JsonReader.BindObject> binder)
binder - registered binder factory
public DslJson.Settings<TContext> includeServiceLoader()
Note that gradle on Android has issues with preserving that file, in which case it can be provided manually. DslJson will fall back to "expected" class name if it doesn't find anything during scanning.
public DslJson.Settings<TContext> includeServiceLoader(ClassLoader loader)
Note that gradle on Android has issues with preserving that file, in which case it can be provided manually. DslJson will fall back to "expected" class name if it doesn't find anything during scanning.
loader - ClassLoader to use
public DslJson.Settings<TContext> errorInfo(JsonReader.ErrorInfo errorInfo)
errorInfo - information about error in parsing exception
public DslJson.Settings<TContext> doublePrecision(JsonReader.DoublePrecision precision)
precision - type of double deserialization
public DslJson.Settings<TContext> unknownNumbers(JsonReader.UnknownNumberParsing unknownNumbers)
unknownNumbers - how to deserialize numbers without a schema
public DslJson.Settings<TContext> limitDigitsBuffer(int size)
size - maximum allowed size for digit buffer
public DslJson.Settings<TContext> limitStringBuffer(int size)
size - maximum size of buffer in bytes
public DslJson.Settings<TContext> with(Configuration conf)
conf - custom extensibility point
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||