public interface JSONConfigDefaultsMBean
| Modifier and Type | Method and Description |
|---|---|
DateFormat |
addDateParseFormat(String fmtStr)
Add a date parsing format to the list of date parsing formats
used by the parser when encodeDatesAsStrings or
encodeDatesAsObjects is true.
|
void |
addReflectClassByName(String className)
Add the given class to the set of classes to be reflected.
|
void |
clearDateGenFormat()
Clear date generation format.
|
void |
clearDateParseFormats()
Clear any date parse formats from the list of formats
used by the parser when encodeDatesAsStrings or
encodeDatesAsObjects is true.
|
void |
clearNumberFormats()
Clear any default number formats.
|
void |
clearReflectClasses()
Clear all reflection classes, disabling all default automatic reflection.
|
void |
clearReflectionCache()
Clear the reflection cache.
|
String |
getLocaleLanguageTag()
Get the default locale for new
JSONConfig objects in string form. |
int |
getReflectionPrivacy()
Get the reflection privacy level.
|
int |
getUndefinedCodePointPolicy()
Get the default policy for undefined code points.
|
int |
getUnmatchedSurrogatePolicy()
Get the default policy for unmatched surrogates.
|
boolean |
isAllowReservedWordsInIdentifiers()
Get the default for allowing reserved words in identifiers.
|
boolean |
isCacheReflectionData()
Get the the cacheReflectionData policy.
|
boolean |
isDetectDataStructureLoops()
Get the default detect data structure loops policy.
|
boolean |
isEncodeDatesAsObjects()
Get the encode dates as objects policy.
|
boolean |
isEncodeDatesAsStrings()
Get the encode dates as strings policy.
|
boolean |
isEncodeNumericStringsAsNumbers()
Get the default encode numeric strings as numbers policy.
|
boolean |
isEscapeBadIdentifierCodePoints()
Get the default escape bad identifier code points policy.
|
boolean |
isEscapeNonAscii()
Get the default escape non-ASCII policy.
|
boolean |
isEscapeSurrogates()
Get the default escape surrogates policy.
|
boolean |
isFastStrings()
Get the fastStrings policy.
|
boolean |
isFullJSONIdentifierCodePoints()
Get the full JSON identifier code points policy.
|
boolean |
isPassThroughEscapes()
Get the pass through escapes policy.
|
boolean |
isPreciseNumbers()
Get the preciseFloatingPoint policy.
|
boolean |
isQuoteIdentifier()
Get the default quote identifier policy.
|
boolean |
isReflectUnknownObjects()
Get the reflection of unknown objects policy.
|
boolean |
isSmallNumbers()
Get the smallNumbers policy.
|
boolean |
isUnEscapeWherePossible()
The default unEscape policy.
|
boolean |
isUseECMA6()
Get the default escape ECMAScript 6 code points policy.
|
boolean |
isUsePrimitiveArrays()
The primitive arrays policy.
|
boolean |
isValidatePropertyNames()
Get the default validate property names policy.
|
String |
listReflectedClasses()
Get a string with newline separated list of classes that get reflected.
|
void |
removeReflectClassByName(String className)
Remove the given class from the set of classes to be reflected.
|
void |
setAllowReservedWordsInIdentifiers(boolean dflt)
Set default flag for allowing reserved words in identifiers.
|
void |
setCacheReflectionData(boolean dflt)
If true, then when an object is reflected its reflection data
will be cached to improve performance on subsequent reflections
of objects of its class.
|
void |
setCodeDefaults()
Reset all defaults to their original unmodified values.
|
DateFormat |
setDateGenFormat(String fmtStr)
Set the date format used for date string generation when
encodeDatesAsStrings or encodeDatesAsObjects is true.
|
void |
setDetectDataStructureLoops(boolean dflt)
Set the default flag for detecting data structure loops.
|
void |
setEncodeDatesAsObjects(boolean dflt)
If true, then
Date objects will be encoded as
Javascript dates, using new Date(dateString). |
void |
setEncodeDatesAsStrings(boolean dflt)
Set the encodeDatesAsStrings policy.
|
void |
setEncodeNumericStringsAsNumbers(boolean dflt)
Set the default flag for encoding of numeric strings as numbers.
|
void |
setEscapeBadIdentifierCodePoints(boolean dflt)
If true, then any bad code points in identifiers will be escaped.
|
void |
setEscapeNonAscii(boolean dflt)
Set the default flag for forcing escaping of non-ASCII characters in
strings and identifiers.
|
void |
setEscapeSurrogates(boolean dflt)
Set the default escapeSurrogates policy.
|
void |
setFastStrings(boolean dflt)
If true, then string values will be copied to the output with no escaping
or validation.
|
void |
setFullJSONIdentifierCodePoints(boolean dflt)
If true, then the full set of identifier code points permitted by the
JSON standard will be allowed instead of the more restrictive set
permitted by the ECMAScript standard.
|
void |
setLocaleLanguageTag(String languageTag)
Set the default locale for new
JSONConfig objects to use. |
void |
setPassThroughEscapes(boolean dflt)
If true, then escapes in strings will be passed through unchanged.
|
void |
setPreciseNumbers(boolean dflt)
If true then numbers which are not exactly representable by a 64 bit
double precision floating point number will be quoted in the output.
|
void |
setQuoteIdentifier(boolean dflt)
Set the default flag for forcing quotes on identifiers.
|
void |
setReflectionPrivacy(int dflt)
Set the privacy level for reflection.
|
void |
setReflectUnknownObjects(boolean dflt)
Set the reflection encoding policy.
|
void |
setSmallNumbers(boolean dflt)
If true then
JSONParser will attempt to minimize the
storage used for all numbers. |
void |
setUndefinedCodePointPolicy(int dflt)
Tell JSONUtil what to do by default when it encounters undefined code points in strings
and identifiers.
|
void |
setUnEscapeWherePossible(boolean dflt)
Set default flag for undoing inline escapes in strings.
|
void |
setUnmatchedSurrogatePolicy(int dflt)
Tell JSONUtil what to do by default when it encounters unmatched surrogates in strings
and identifiers.
|
void |
setUseECMA6(boolean dflt)
If you set this to true, then when JSONUtil generates Unicode
escapes, it will use ECMAScript 6 code point escapes if they are shorter
than code unit escapes.
|
void |
setUsePrimitiveArrays(boolean dflt)
If true, then when
JSONParser encounters a JSON array of non-null
wrappers of primitives and those primitives are all compatible with each
other, then instead of an ArrayList of wrappers for those
primitives it will create an array of those primitives in order to save
memory. |
void |
setValidatePropertyNames(boolean dflt)
Set the default flag for validation of property names.
|
void setCodeDefaults()
String getLocaleLanguageTag()
JSONConfig objects in string form.void setLocaleLanguageTag(String languageTag)
JSONConfig objects to use.languageTag - A language tag suitable for use by Locale.forLanguageTag(String).void clearNumberFormats()
DateFormat setDateGenFormat(String fmtStr)
fmtStr - passed to the constructor for
SimpleDateFormat.SimpleDateFormat(String,Locale) using
the result of JSONConfigDefaults.getLocale().void clearDateGenFormat()
DateFormat addDateParseFormat(String fmtStr)
fmtStr - Passed to
SimpleDateFormat.SimpleDateFormat(String,Locale) using
the result of JSONConfigDefaults.getLocale().void clearDateParseFormats()
boolean isValidatePropertyNames()
int getReflectionPrivacy()
void setReflectionPrivacy(int dflt)
throws MBeanException
ReflectUtil.PRIVATE which includes all fields when reflection is
enabled.dflt - the level to setMBeanException - If the privacy level is not allowed.ReflectUtil.PRIVATE,
ReflectUtil.PACKAGE,
ReflectUtil.PROTECTED,
ReflectUtil.PUBLICvoid clearReflectClasses()
void clearReflectionCache()
void addReflectClassByName(String className) throws MBeanException
className - The name of the class suitable for
(@link ClassLoader.loadClass(String)}.MBeanException - If there's a problem loading the class.void removeReflectClassByName(String className) throws MBeanException
className - The name of the class suitable for
(@link ClassLoader.loadClass(String)}.MBeanException - If there's a problem loading the class.String listReflectedClasses()
int getUnmatchedSurrogatePolicy()
void setUnmatchedSurrogatePolicy(int dflt)
JSONConfig.REPLACE - Replace with Unicode replacement character U+FFFD (default)JSONConfig.DISCARD - Discard them.JSONConfig.EXCEPTION - Throw a UndefinedCodePointExceptionJSONConfig.ESCAPE - Include them but escape themJSONConfig.PASS - Pass them through unmodified.dflt - the default unmatchedSurrogatePolicy to setint getUndefinedCodePointPolicy()
void setUndefinedCodePointPolicy(int dflt)
JSONConfig.REPLACE - Replace with Unicode replacement character U+FFFD (default)JSONConfig.DISCARD - Discard them.JSONConfig.EXCEPTION - Throw a UndefinedCodePointExceptionJSONConfig.ESCAPE - Include them but escape themJSONConfig.PASS - Pass them through unmodified.dflt - the default undefinedCodePointPolicy to setvoid setValidatePropertyNames(boolean dflt)
JSONConfig objects created after this call
within the same class loader.dflt - If true, then property names will be validated by default.boolean isDetectDataStructureLoops()
void setDetectDataStructureLoops(boolean dflt)
DataStructureLoopException will be thrown.
This will affect all new JSONConfig objects created after this call
within the same class loader.dflt - If true, then the code will detect loops in data structures.boolean isEscapeBadIdentifierCodePoints()
void setEscapeBadIdentifierCodePoints(boolean dflt)
dflt - if true, then any bad code points in identifiers will be escaped.boolean isFullJSONIdentifierCodePoints()
void setFullJSONIdentifierCodePoints(boolean dflt)
dflt - If true, then allow all code points permitted by the JSON standard in identifiers.boolean isFastStrings()
void setFastStrings(boolean dflt)
Only use this if you know that you have no characters in the range U+0000-U+001F or backslash or forward slash or double quote in your strings. If you want your JSON to be parsable by Javascript eval() then you also need to make sure that you don't have U+2028 (line separator) or U+2029 (paragraph separator).
That said, if you are encoding a lot of large strings, this can improve performance by eliminating the check for characters that need to be escaped.
dflt - If true, then strings will be copied as is with no escaping
or validation.boolean isEncodeNumericStringsAsNumbers()
void setEncodeNumericStringsAsNumbers(boolean dflt)
dflt - If true, then strings that look like valid JSON numbers
will be encoded as numbers.boolean isEscapeNonAscii()
void setEscapeNonAscii(boolean dflt)
JSONConfig objects created after this
call within the same class loader.dflt - If true, then all non-ASCII will be Unicode escaped.boolean isUnEscapeWherePossible()
void setUnEscapeWherePossible(boolean dflt)
dflt - If true then where possible, undo inline escapes in strings.boolean isEscapeSurrogates()
void setEscapeSurrogates(boolean dflt)
dflt - If true, then surrogates will be escaped in strings and identifiers
and escapeNonAscii will be forced to false.boolean isPassThroughEscapes()
Accessible via MBean server.
void setPassThroughEscapes(boolean dflt)
Accessible via MBean server.
dflt - If true, then pass escapes through.boolean isEncodeDatesAsStrings()
void setEncodeDatesAsStrings(boolean dflt)
Accessible via MBean server.
dflt - If true, then Date objects will be encoded as ISO 8601 date
strings or a custom date format if you have called
JSONConfigDefaults.setDateGenFormat(DateFormat).boolean isReflectUnknownObjects()
void setReflectUnknownObjects(boolean dflt)
dflt - If true, then attempt to use reflection
to encode objects which are otherwise unknown.boolean isPreciseNumbers()
void setPreciseNumbers(boolean dflt)
dflt - If true then quote numbers that lose precision in 64-bit floating point.boolean isSmallNumbers()
void setSmallNumbers(boolean dflt)
JSONParser will attempt to minimize the
storage used for all numbers. Decimal numbers will be reduced
to floats instead of doubles if it can done without losing
precision. Integer numbers will be reduced from long to int
or short or byte if they fit.dflt - If true then numbers will be made to use as little memory as possible.boolean isUsePrimitiveArrays()
void setUsePrimitiveArrays(boolean dflt)
JSONParser encounters a JSON array of non-null
wrappers of primitives and those primitives are all compatible with each
other, then instead of an ArrayList of wrappers for those
primitives it will create an array of those primitives in order to save
memory.
This works for booleans and numbers. It will also convert an array of single character strings into an array of chars. Arrays of numbers will attempt to use the least complex type that does not lose information. You could easily end up with an array of bytes if all of your numbers are integers in the range -128 to 127. This option is meant to save as much memory as possible.
dflt - if true, then the parser will create arrays of primitives as
applicable.boolean isCacheReflectionData()
void setCacheReflectionData(boolean dflt)
dflt - if true, then cache reflection data.boolean isQuoteIdentifier()
void setQuoteIdentifier(boolean dflt)
JSONConfig objects created after this call
within the same class loader.
Accessible via MBean server.
dflt - If true, then all identifiers will be quoted.boolean isUseECMA6()
void setUseECMA6(boolean dflt)
dflt - If true, use EMCAScript 6 code point escapes and allow
ECMAScript 6 identifier character set.boolean isAllowReservedWordsInIdentifiers()
void setAllowReservedWordsInIdentifiers(boolean dflt)
dflt - If true, then reserved words will be allowed in identifiers.boolean isEncodeDatesAsObjects()
void setEncodeDatesAsObjects(boolean dflt)
Date objects will be encoded as
Javascript dates, using new Date(dateString). If you
set this to true, then encodeDatesAsStrings will be
set to false.dflt - If true, then Date objects will be encoded as
Javascript dates.Copyright © 2016. All rights reserved.