public final class ObjenesisHelper
extends java.lang.Object
限定符和类型 | 方法和说明 |
---|---|
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)
|
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)