public final class RuntimeEnv extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
RuntimeEnv.Instantiator<T> |
| Modifier and Type | Field and Description |
|---|---|
static boolean |
ALWAYS_USE_SUN_REFLECTION_FACTORY
If true, the constructor will always be obtained from
ReflectionFactory.newConstructorFromSerialization. |
static boolean |
AUTO_LOAD_POLYMORPHIC_CLASSES
Enabled by default.
|
static boolean |
COLLECTION_SCHEMA_ON_REPEATED_FIELDS
On repeated fields, the List/Collection itself is not serialized (only its values).
|
static boolean |
ENUMS_BY_NAME
Returns true if serializing enums by name is activated.
|
static IdStrategy |
ID_STRATEGY |
static boolean |
JAVA_9_AND_ABOVE
true for JDKs 9, 10, 11, etc; false for 1.8 and below. |
static boolean |
MORPH_COLLECTION_INTERFACES
Disabled by default.
|
static boolean |
MORPH_MAP_INTERFACES
Disabled by default.
|
static boolean |
MORPH_NON_FINAL_POJOS
Disabled by default.
|
static boolean |
NEVER_USE_SUN_REFLECTION_FACTORY
If true, the constructor will never be obtained from
ReflectionFactory.newConstructorFromSerialization. |
static boolean |
POJO_SCHEMA_ON_COLLECTION_FIELDS
Disabled by default.
|
static boolean |
POJO_SCHEMA_ON_MAP_FIELDS
Disabled by default.
|
static boolean |
PRESERVE_NULL_ELEMENTS
Disabled by default.
|
static boolean |
USE_SUN_MISC_UNSAFE
If true, sun.misc.Unsafe is used to access the fields of the objects instead of plain java reflections.
|
| Modifier and Type | Method and Description |
|---|---|
static <T> RuntimeEnv.Instantiator<T> |
newInstantiator(Class<T> clazz)
Returns an instatiator for the specified
clazz. |
public static final boolean JAVA_9_AND_ABOVE
true for JDKs 9, 10, 11, etc; false for 1.8 and below.public static final boolean ENUMS_BY_NAME
public static final boolean AUTO_LOAD_POLYMORPHIC_CLASSES
public static final boolean PRESERVE_NULL_ELEMENTS
public static final boolean MORPH_NON_FINAL_POJOS
public static final boolean MORPH_COLLECTION_INTERFACES
If disabled, type metadata will not be included and instead, will be mapped to a default impl.
Collection = ArrayList List = ArrayList Set = HashSet SortedSet = TreeSet NavigableSet = TreeSet Queue = LinkedList BlockingQueue = LinkedBlockingQueue Deque = LinkedList BlockingDequeue = LinkedBlockingDeque
You can optionally enable only for a particular field by annotating it with Morph.
public static final boolean MORPH_MAP_INTERFACES
If disabled, type metadata will not be included and instead, will be mapped to a default impl.
Map = HashMap SortedMap = TreeMap NavigableMap = TreeMap ConcurrentMap = ConcurrentHashMap ConcurrentNavigableMap = ConcurrentSkipListMap
You can optionally enable only for a particular field by annotating it with Morph.
public static final boolean COLLECTION_SCHEMA_ON_REPEATED_FIELDS
This is particularly useful if you rely on Object.equals(Object) on your pojos.
Disabled by default for protobuf compatibility.
public static final boolean POJO_SCHEMA_ON_COLLECTION_FIELDS
public static final boolean POJO_SCHEMA_ON_MAP_FIELDS
public static final boolean USE_SUN_MISC_UNSAFE
public static final boolean ALWAYS_USE_SUN_REFLECTION_FACTORY
ReflectionFactory.newConstructorFromSerialization.
Disabled by default, which means that if the pojo has a no-args constructor, that will be used instead.
Enable this if you intend to avoid deserializing objects whose no-args constructor initializes (unwanted) internal state. This applies to complex/framework objects.
If you intend to fill default field values using your default constructor, leave this disabled. This normally applies to java beans/data objects.
public static final boolean NEVER_USE_SUN_REFLECTION_FACTORY
ReflectionFactory.newConstructorFromSerialization.
Disabled by default, which means that if the pojo has no default constructor, sun reflection will be instead.
Enable this if you intend to enforce filling default field values using your default constructor. This applies to complex/framework objects which may be designed with non-default constructors only. Usually it only makes sense to use this option in your development environment to fail fast on those objects instead of deferring a problem of non-initialized fields to later stages.
public static final IdStrategy ID_STRATEGY
public static <T> RuntimeEnv.Instantiator<T> newInstantiator(Class<T> clazz)
clazz.Copyright © 2009–2022. All rights reserved.