org.objenesis.Objenesis Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of objenesis Show documentation
Show all versions of objenesis Show documentation
A library for instantiating Java objects
package org.objenesis;
import org.objenesis.instantiator.ObjectInstantiator;
/**
* Common interface to all kind of Objenesis objects
*
* @author Henri Tremblay
*/
public interface Objenesis {
/**
* Will create a new object without any constructor being called
*
* @param clazz Class to instantiate
* @return New instance of clazz
*/
Object newInstance(Class clazz);
/**
* 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 calling {@link #newInstance(Class)}.
*
* @param clazz Class to instantiate
* @return Instantiator dedicated to the class
*/
ObjectInstantiator getInstantiatorOf(Class clazz);
}