Package org.objenesis
Interface Objenesis
- All Known Implementing Classes:
ObjenesisBase
,ObjenesisSerializer
,ObjenesisStd
public interface Objenesis
Common interface to all kind of Objenesis objects
-
Method Summary
Modifier and TypeMethodDescription<T> ObjectInstantiator
<T> getInstantiatorOf
(Class<T> clazz) Will pick the best instantiator for the provided class.<T> T
newInstance
(Class<T> clazz) Will create a new object without any constructor being called
-
Method Details
-
newInstance
Will create a new object without any constructor being called- Type Parameters:
T
- Type instantiated- Parameters:
clazz
- Class to instantiate- Returns:
- New instance of clazz
-
getInstantiatorOf
Will pick the best instantiator for the provided class. If you need to create a lot of instances from the same class, it is way more efficient to create them from the same ObjectInstantiator than callingnewInstance(Class)
.- Type Parameters:
T
- Type to instantiate- Parameters:
clazz
- Class to instantiate- Returns:
- Instantiator dedicated to the class
-