public static class WriteOptionsBuilder.DefaultWriteOptions extends Object implements WriteOptions
WriteOptions.ShowType
Modifier and Type | Method and Description |
---|---|
void |
clearCaches() |
JsonWriter.JsonClassWriter |
findCustomWriter(Class<?> c) |
List<Accessor> |
getAccessorsForClass(Class<?> c) |
Object |
getCustomOption(String key)
Get a custom option
|
JsonWriter.JsonClassWriter |
getCustomWriter(Class<?> c)
Fetch the custom writer for the passed in Class.
|
Map<String,Field> |
getDeepDeclaredFields(Class<?> c)
Gets the declared fields for the full class hierarchy of a given class
|
String |
getTypeNameAlias(String typeName)
Alias Type Names, e.g.
|
boolean |
isAlwaysShowingType() |
boolean |
isCustomWrittenClass(Class<?> clazz) |
boolean |
isLongDateFormat() |
boolean |
isMinimalShowingType() |
boolean |
isNeverShowingType() |
boolean |
isNonReferenceableClass(Class<?> clazz) |
boolean |
isNotCustomWrittenClass(Class<?> clazz) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getClassLoader, isAllowNanAndInfinity, isCloseStream, isEnumPublicFieldsOnly, isForceMapOutputAsTwoArrays, isPrettyPrint, isShortMetaKeys, isSkipNullFields, isWriteLongsAsStrings
public String getTypeNameAlias(String typeName)
getTypeNameAlias
in interface WriteOptions
typeName
- String name of type to fetch alias for. There are no default aliases.public boolean isAlwaysShowingType()
isAlwaysShowingType
in interface WriteOptions
public boolean isNeverShowingType()
isNeverShowingType
in interface WriteOptions
public boolean isMinimalShowingType()
isMinimalShowingType
in interface WriteOptions
public boolean isCustomWrittenClass(Class<?> clazz)
isCustomWrittenClass
in interface WriteOptions
clazz
- Class to check to see if there is a custom writer associated to it.public boolean isNotCustomWrittenClass(Class<?> clazz)
isNotCustomWrittenClass
in interface WriteOptions
clazz
- Class to see if it is on the not-customized list. Classes are added to this list when
a class is being picked up through inheritance, and you don't want it to have a custom
writer associated to it.public List<Accessor> getAccessorsForClass(Class<?> c)
getAccessorsForClass
in interface WriteOptions
public boolean isLongDateFormat()
isLongDateFormat
in interface WriteOptions
public boolean isNonReferenceableClass(Class<?> clazz)
isNonReferenceableClass
in interface WriteOptions
clazz
- Class to check to see if it is non-referenceable. Non-referenceable classes will always create
a new instance when read in and never use @id/@ref. This uses more memory when the JSON is read in,
as there will be a separate instance in memory for each occurrence. There are certain classes that
json-io automatically treats as non-referenceable, like Strings, Enums, Class, and any Number
instance (BigDecimal, AtomicLong, etc.) You can add to this list. Often, non-referenceable classes
are useful for classes that can be defined in one line as a JSON, like a LocalDateTime, for example.public JsonWriter.JsonClassWriter getCustomWriter(Class<?> c)
getCustomWriter
in interface WriteOptions
c
- Class of object for which fetch a custom writerpublic JsonWriter.JsonClassWriter findCustomWriter(Class<?> c)
public Object getCustomOption(String key)
WriteOptions
getCustomOption
in interface WriteOptions
key
- String name of the custom optionpublic void clearCaches()
clearCaches
in interface WriteOptions
public Map<String,Field> getDeepDeclaredFields(Class<?> c)
getDeepDeclaredFields
in interface WriteOptions
c
- - given class.Copyright © 2024. All rights reserved.