public final class JSONFactory
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
(package private) static class |
JSONFactory.CacheItem |
static class |
JSONFactory.Conf |
static interface |
JSONFactory.JSONPathCompiler |
(package private) static interface |
JSONFactory.JSONReaderUTF16Creator |
(package private) static interface |
JSONFactory.JSONReaderUTF8Creator |
(package private) static class |
JSONFactory.NameCacheEntry |
(package private) static class |
JSONFactory.NameCacheEntry2 |
| Modifier and Type | Field and Description |
|---|---|
(package private) static ObjectReader<JSONArray> |
ARRAY_READER |
(package private) static java.util.concurrent.atomic.AtomicReferenceFieldUpdater<JSONFactory.CacheItem,byte[]> |
BYTES_UPDATER |
(package private) static char[] |
CA |
(package private) static JSONFactory.CacheItem[] |
CACHE_ITEMS |
(package private) static int |
CACHE_THRESHOLD |
(package private) static java.util.concurrent.atomic.AtomicReferenceFieldUpdater<JSONFactory.CacheItem,char[]> |
CHARS_UPDATER |
static java.lang.String |
CREATOR |
(package private) static java.util.function.Supplier<java.util.List> |
defaultArraySupplier |
(package private) static int |
defaultDecimalMaxScale |
(package private) static JSONFactory.JSONPathCompiler |
defaultJSONPathCompiler |
(package private) static int |
defaultMaxLevel |
(package private) static ObjectReaderProvider |
defaultObjectReaderProvider |
(package private) static java.util.function.Supplier<java.util.Map> |
defaultObjectSupplier |
(package private) static ObjectWriterProvider |
defaultObjectWriterProvider |
(package private) static long |
defaultReaderFeatures |
(package private) static java.lang.String |
defaultReaderFormat |
(package private) static java.time.ZoneId |
defaultReaderZoneId |
(package private) static boolean |
defaultSkipTransient |
(package private) static boolean |
defaultWriterAlphabetic |
(package private) static long |
defaultWriterFeatures |
(package private) static java.lang.String |
defaultWriterFormat |
(package private) static java.time.ZoneId |
defaultWriterZoneId |
(package private) static int[] |
DIGITS2 |
(package private) static boolean |
disableArrayMapping |
(package private) static boolean |
disableAutoType |
(package private) static boolean |
disableJSONB |
(package private) static boolean |
disableReferenceDetect |
(package private) static boolean |
disableSmartMatch |
(package private) static double[] |
DOUBLE_10_POW |
(package private) static float[] |
FLOAT_10_POW |
(package private) static java.lang.Throwable |
initErrorLast |
private static boolean |
jsonFieldDefaultValueCompatMode |
(package private) static java.lang.ThreadLocal<JSONFactory.JSONPathCompiler> |
jsonPathCompilerLocal |
(package private) static JSONFactory.NameCacheEntry[] |
NAME_CACHE |
(package private) static JSONFactory.NameCacheEntry2[] |
NAME_CACHE2 |
(package private) static byte[] |
NIBBLES |
(package private) static ObjectReader<JSONObject> |
OBJECT_READER |
static PropertyAccessorFactory |
PROPERTY_ACCESSOR_FACTORY |
static java.lang.String |
PROPERTY_AUTO_TYPE_ACCEPT |
static java.lang.String |
PROPERTY_AUTO_TYPE_BEFORE_HANDLER |
static java.lang.String |
PROPERTY_AUTO_TYPE_HANDLER |
static java.lang.String |
PROPERTY_DENY_PROPERTY |
(package private) static java.lang.ThreadLocal<ObjectReaderCreator> |
readerCreatorLocal |
(package private) static java.lang.ThreadLocal<ObjectReaderProvider> |
readerProviderLocal |
(package private) static boolean |
useGsonAnnotation |
(package private) static boolean |
useJacksonAnnotation |
(package private) static java.lang.ThreadLocal<ObjectWriterCreator> |
writerCreatorLocal |
| Constructor and Description |
|---|
JSONFactory() |
| Modifier and Type | Method and Description |
|---|---|
static JSONReader.Context |
createReadContext()
Creates a new JSON reader context with default settings.
|
static JSONReader.Context |
createReadContext(Filter filter,
JSONReader.Feature... features) |
static JSONReader.Context |
createReadContext(JSONReader.Feature... features)
Creates a new JSON reader context with the specified features.
|
static JSONReader.Context |
createReadContext(long features)
Creates a new JSON reader context with the specified features.
|
static JSONReader.Context |
createReadContext(ObjectReaderProvider provider,
JSONReader.Feature... features) |
static JSONReader.Context |
createReadContext(java.util.function.Supplier<java.util.Map> objectSupplier,
JSONReader.Feature... features) |
static JSONReader.Context |
createReadContext(java.util.function.Supplier<java.util.Map> objectSupplier,
java.util.function.Supplier<java.util.List> arraySupplier,
JSONReader.Feature... features) |
static JSONReader.Context |
createReadContext(SymbolTable symbolTable) |
static JSONReader.Context |
createReadContext(SymbolTable symbolTable,
JSONReader.Feature... features) |
static JSONWriter.Context |
createWriteContext()
Creates a new JSON writer context with default settings.
|
static JSONWriter.Context |
createWriteContext(JSONWriter.Feature... features)
Creates a new JSON writer context with the specified features.
|
static JSONWriter.Context |
createWriteContext(ObjectWriterProvider provider,
JSONWriter.Feature... features)
Creates a new JSON writer context with the specified provider and features.
|
static ObjectReaderCreator |
getContextReaderCreator()
Gets the object reader creator for the current thread context.
|
static ObjectWriterCreator |
getContextWriterCreator()
Gets the object writer creator for the current thread context.
|
static java.util.function.Supplier<java.util.List> |
getDefaultArraySupplier()
Gets the default array supplier used when creating JSON arrays.
|
static JSONFactory.JSONPathCompiler |
getDefaultJSONPathCompiler()
Gets the default JSONPath compiler.
|
static int |
getDefaultMaxLevel() |
static ObjectReaderProvider |
getDefaultObjectReaderProvider()
Gets the default object reader provider.
|
static java.util.function.Supplier<java.util.Map> |
getDefaultObjectSupplier()
Gets the default object supplier used when creating JSON objects.
|
static ObjectWriterProvider |
getDefaultObjectWriterProvider()
Gets the default object writer provider.
|
static long |
getDefaultReaderFeatures()
Gets the default reader features.
|
static java.lang.String |
getDefaultReaderFormat()
Gets the default reader format string.
|
static java.time.ZoneId |
getDefaultReaderZoneId()
Gets the default reader zone ID.
|
static long |
getDefaultWriterFeatures()
Gets the default writer features.
|
static java.lang.String |
getDefaultWriterFormat()
Gets the default writer format string.
|
static java.time.ZoneId |
getDefaultWriterZoneId()
Gets the default writer zone ID.
|
static ObjectReader |
getObjectReader(java.lang.reflect.Type type,
long features) |
static ObjectWriter |
getObjectWriter(java.lang.reflect.Type type,
long features) |
static java.lang.String |
getProperty(java.lang.String key) |
private static boolean |
getPropertyBool(java.util.Properties properties,
java.lang.String name,
boolean defaultValue) |
private static int |
getPropertyInt(java.util.Properties properties,
java.lang.String name,
int defaultValue) |
static boolean |
isDefaultSkipTransient()
Checks if transient fields are skipped by default.
|
static boolean |
isDefaultWriterAlphabetic()
Checks if the default writer uses alphabetic ordering.
|
static boolean |
isDisableArrayMapping()
Checks if array mapping is disabled.
|
static boolean |
isDisableAutoType()
Checks if auto type support is disabled.
|
static boolean |
isDisableJSONB()
Checks if JSONB format is disabled.
|
static boolean |
isDisableReferenceDetect()
Checks if reference detection is disabled.
|
static boolean |
isDisableSmartMatch()
Checks if smart matching is disabled.
|
static boolean |
isJSONFieldDefaultValueCompatMode() |
static boolean |
isUseGsonAnnotation() |
static boolean |
isUseJacksonAnnotation() |
static void |
setContextJSONPathCompiler(JSONFactory.JSONPathCompiler compiler)
Sets the JSONPath compiler for the current thread context.
|
static void |
setContextObjectReaderProvider(ObjectReaderProvider creator)
Sets the object reader provider for the current thread context.
|
static void |
setContextReaderCreator(ObjectReaderCreator creator)
Sets the object reader creator for the current thread context.
|
static void |
setContextWriterCreator(ObjectWriterCreator creator)
Sets the object writer creator for the current thread context.
|
static void |
setDefaultArraySupplier(java.util.function.Supplier<java.util.List> arraySupplier)
Sets the default array supplier used when creating JSON arrays.
|
static void |
setDefaultMaxLevel(int maxLevel) |
static void |
setDefaultObjectSupplier(java.util.function.Supplier<java.util.Map> objectSupplier)
Sets the default object supplier used when creating JSON objects.
|
static void |
setDefaultSkipTransient(boolean skipTransient)
Sets whether transient fields should be skipped by default.
|
static void |
setDefaultWriterAlphabetic(boolean defaultWriterAlphabetic)
Sets whether the default writer should use alphabetic ordering.
|
static void |
setDisableArrayMapping(boolean disableArrayMapping)
Sets whether array mapping should be disabled.
|
static void |
setDisableAutoType(boolean disableAutoType)
Sets whether auto type support should be disabled.
|
static void |
setDisableJSONB(boolean disableJSONB)
Sets whether JSONB format should be disabled.
|
static void |
setDisableReferenceDetect(boolean disableReferenceDetect)
Sets whether reference detection should be disabled.
|
static void |
setDisableSmartMatch(boolean disableSmartMatch)
Sets whether smart matching should be disabled.
|
static void |
setJSONFieldDefaultValueCompatMode(boolean compatMode) |
static void |
setUseGsonAnnotation(boolean useGsonAnnotation) |
static void |
setUseJacksonAnnotation(boolean useJacksonAnnotation) |
static volatile java.lang.Throwable initErrorLast
public static final java.lang.String CREATOR
public static final java.lang.String PROPERTY_DENY_PROPERTY
public static final java.lang.String PROPERTY_AUTO_TYPE_ACCEPT
public static final java.lang.String PROPERTY_AUTO_TYPE_HANDLER
public static final java.lang.String PROPERTY_AUTO_TYPE_BEFORE_HANDLER
static boolean useJacksonAnnotation
static boolean useGsonAnnotation
static long defaultReaderFeatures
static java.lang.String defaultReaderFormat
static java.time.ZoneId defaultReaderZoneId
static long defaultWriterFeatures
static java.lang.String defaultWriterFormat
static java.time.ZoneId defaultWriterZoneId
static boolean defaultWriterAlphabetic
static boolean defaultSkipTransient
static final boolean disableReferenceDetect
static final boolean disableArrayMapping
static final boolean disableJSONB
static final boolean disableAutoType
static final boolean disableSmartMatch
static java.util.function.Supplier<java.util.Map> defaultObjectSupplier
static java.util.function.Supplier<java.util.List> defaultArraySupplier
static final JSONFactory.NameCacheEntry[] NAME_CACHE
static final JSONFactory.NameCacheEntry2[] NAME_CACHE2
static int defaultDecimalMaxScale
static int defaultMaxLevel
public static final PropertyAccessorFactory PROPERTY_ACCESSOR_FACTORY
static final char[] CA
static final int[] DIGITS2
static final float[] FLOAT_10_POW
static final double[] DOUBLE_10_POW
private static volatile boolean jsonFieldDefaultValueCompatMode
static final JSONFactory.CacheItem[] CACHE_ITEMS
static final int CACHE_THRESHOLD
static final java.util.concurrent.atomic.AtomicReferenceFieldUpdater<JSONFactory.CacheItem,char[]> CHARS_UPDATER
static final java.util.concurrent.atomic.AtomicReferenceFieldUpdater<JSONFactory.CacheItem,byte[]> BYTES_UPDATER
static final ObjectWriterProvider defaultObjectWriterProvider
static final ObjectReaderProvider defaultObjectReaderProvider
static final JSONFactory.JSONPathCompiler defaultJSONPathCompiler
static final java.lang.ThreadLocal<ObjectReaderCreator> readerCreatorLocal
static final java.lang.ThreadLocal<ObjectReaderProvider> readerProviderLocal
static final java.lang.ThreadLocal<ObjectWriterCreator> writerCreatorLocal
static final java.lang.ThreadLocal<JSONFactory.JSONPathCompiler> jsonPathCompilerLocal
static final ObjectReader<JSONArray> ARRAY_READER
static final ObjectReader<JSONObject> OBJECT_READER
static final byte[] NIBBLES
public static java.lang.String getProperty(java.lang.String key)
private static boolean getPropertyBool(java.util.Properties properties,
java.lang.String name,
boolean defaultValue)
private static int getPropertyInt(java.util.Properties properties,
java.lang.String name,
int defaultValue)
public static boolean isUseJacksonAnnotation()
public static boolean isUseGsonAnnotation()
public static void setUseJacksonAnnotation(boolean useJacksonAnnotation)
public static void setUseGsonAnnotation(boolean useGsonAnnotation)
public static boolean isJSONFieldDefaultValueCompatMode()
public static void setJSONFieldDefaultValueCompatMode(boolean compatMode)
public static int getDefaultMaxLevel()
public static void setDefaultMaxLevel(int maxLevel)
public static void setDefaultObjectSupplier(java.util.function.Supplier<java.util.Map> objectSupplier)
objectSupplier - the supplier for creating Map instancespublic static void setDefaultArraySupplier(java.util.function.Supplier<java.util.List> arraySupplier)
arraySupplier - the supplier for creating List instancespublic static java.util.function.Supplier<java.util.Map> getDefaultObjectSupplier()
public static java.util.function.Supplier<java.util.List> getDefaultArraySupplier()
public static JSONWriter.Context createWriteContext()
public static JSONWriter.Context createWriteContext(ObjectWriterProvider provider, JSONWriter.Feature... features)
provider - the object writer providerfeatures - the features to enablepublic static JSONWriter.Context createWriteContext(JSONWriter.Feature... features)
features - the features to enablepublic static JSONReader.Context createReadContext()
public static JSONReader.Context createReadContext(long features)
features - the features to enablepublic static JSONReader.Context createReadContext(JSONReader.Feature... features)
features - the features to enablepublic static JSONReader.Context createReadContext(Filter filter, JSONReader.Feature... features)
public static JSONReader.Context createReadContext(ObjectReaderProvider provider, JSONReader.Feature... features)
public static JSONReader.Context createReadContext(SymbolTable symbolTable)
public static JSONReader.Context createReadContext(SymbolTable symbolTable, JSONReader.Feature... features)
public static JSONReader.Context createReadContext(java.util.function.Supplier<java.util.Map> objectSupplier, JSONReader.Feature... features)
public static JSONReader.Context createReadContext(java.util.function.Supplier<java.util.Map> objectSupplier, java.util.function.Supplier<java.util.List> arraySupplier, JSONReader.Feature... features)
public static ObjectReader getObjectReader(java.lang.reflect.Type type, long features)
public static ObjectWriter getObjectWriter(java.lang.reflect.Type type, long features)
public static ObjectWriterProvider getDefaultObjectWriterProvider()
public static ObjectReaderProvider getDefaultObjectReaderProvider()
public static JSONFactory.JSONPathCompiler getDefaultJSONPathCompiler()
public static void setContextReaderCreator(ObjectReaderCreator creator)
creator - the ObjectReaderCreator to setpublic static void setContextObjectReaderProvider(ObjectReaderProvider creator)
creator - the ObjectReaderProvider to setpublic static ObjectReaderCreator getContextReaderCreator()
public static void setContextJSONPathCompiler(JSONFactory.JSONPathCompiler compiler)
compiler - the JSONPathCompiler to setpublic static void setContextWriterCreator(ObjectWriterCreator creator)
creator - the ObjectWriterCreator to setpublic static ObjectWriterCreator getContextWriterCreator()
public static long getDefaultReaderFeatures()
public static java.time.ZoneId getDefaultReaderZoneId()
public static java.lang.String getDefaultReaderFormat()
public static long getDefaultWriterFeatures()
public static java.time.ZoneId getDefaultWriterZoneId()
public static java.lang.String getDefaultWriterFormat()
public static boolean isDefaultWriterAlphabetic()
public static void setDefaultWriterAlphabetic(boolean defaultWriterAlphabetic)
defaultWriterAlphabetic - true to enable alphabetic ordering, false to disablepublic static boolean isDisableReferenceDetect()
public static boolean isDisableAutoType()
public static boolean isDisableJSONB()
public static boolean isDisableArrayMapping()
public static void setDisableReferenceDetect(boolean disableReferenceDetect)
disableReferenceDetect - true to disable reference detection, false to enablepublic static void setDisableArrayMapping(boolean disableArrayMapping)
disableArrayMapping - true to disable array mapping, false to enablepublic static void setDisableJSONB(boolean disableJSONB)
disableJSONB - true to disable JSONB, false to enablepublic static void setDisableAutoType(boolean disableAutoType)
disableAutoType - true to disable auto type, false to enablepublic static boolean isDisableSmartMatch()
public static void setDisableSmartMatch(boolean disableSmartMatch)
disableSmartMatch - true to disable smart matching, false to enablepublic static boolean isDefaultSkipTransient()
public static void setDefaultSkipTransient(boolean skipTransient)
skipTransient - true to skip transient fields, false to include them