public final class ObjenesisHelper extends Object
Modifier and Type | Method and Description |
---|---|
static <T> ObjectInstantiator<T> |
getInstantiatorOf(Class<T> clazz)
Will pick the best instantiator for the provided class.
|
static <T extends Serializable> |
getSerializableObjectInstantiatorOf(Class<T> clazz)
Same as
getInstantiatorOf(Class) but providing an instantiator emulating
ObjectInputStream.readObject behavior. |
static <T> T |
newInstance(Class<T> clazz)
Will create a new object without any constructor being called
|
static <T extends Serializable> |
newSerializableInstance(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(Class<T> clazz)
T
- Type instantiatedclazz
- Class to instantiatepublic static <T extends Serializable> T newSerializableInstance(Class<T> clazz)
T
- Type instantiatedclazz
- Class to instantiatepublic static <T> ObjectInstantiator<T> getInstantiatorOf(Class<T> clazz)
newInstance(Class)
.T
- Type to instantiateclazz
- Class to instantiatepublic static <T extends Serializable> ObjectInstantiator<T> getSerializableObjectInstantiatorOf(Class<T> clazz)
getInstantiatorOf(Class)
but providing an instantiator emulating
ObjectInputStream.readObject behavior.T
- Type to instantiateclazz
- Class to instantiatenewSerializableInstance(Class)
Copyright © 2006–2024 Joe Walnes, Henri Tremblay, Leonardo Mesquita. All rights reserved.