public final class ObjenesisHelper
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private static Objenesis |
OBJENESIS_SERIALIZER |
private static Objenesis |
OBJENESIS_STD |
Modifier | Constructor and Description |
---|---|
private |
ObjenesisHelper() |
Modifier and Type | Method and Description |
---|---|
static <T> ObjectInstantiator<T> |
getInstantiatorOf(java.lang.Class<T> clazz)
Will pick the best instantiator for the provided class.
|
static <T extends java.io.Serializable> |
getSerializableObjectInstantiatorOf(java.lang.Class<T> clazz)
Same as
getInstantiatorOf(Class) but providing an instantiator emulating
ObjectInputStream.readObject behavior. |
static <T> T |
newInstance(java.lang.Class<T> clazz)
Will create a new object without any constructor being called
|
static <T extends java.io.Serializable> |
newSerializableInstance(java.lang.Class<T> clazz)
Will create an object just like it's done by ObjectInputStream.readObject (the default
constructor of the first non serializable class will be called)
|
private static final Objenesis OBJENESIS_STD
private static final Objenesis OBJENESIS_SERIALIZER
public static <T> T newInstance(java.lang.Class<T> clazz)
T
- Type instantiatedclazz
- Class to instantiatepublic static <T extends java.io.Serializable> T newSerializableInstance(java.lang.Class<T> clazz)
T
- Type instantiatedclazz
- Class to instantiatepublic static <T> ObjectInstantiator<T> getInstantiatorOf(java.lang.Class<T> clazz)
newInstance(Class)
.T
- Type to instantiateclazz
- Class to instantiatepublic static <T extends java.io.Serializable> ObjectInstantiator<T> getSerializableObjectInstantiatorOf(java.lang.Class<T> clazz)
getInstantiatorOf(Class)
but providing an instantiator emulating
ObjectInputStream.readObject behavior.T
- Type to instantiateclazz
- Class to instantiatenewSerializableInstance(Class)