
org.objenesis.instantiator.basic.NewInstanceInstantiator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of mockito-all Show documentation
Show all versions of mockito-all Show documentation
Mock objects library for java, modified to allow cache disabling
The newest version!
package org.objenesis.instantiator.basic;
import org.objenesis.ObjenesisException;
import org.objenesis.instantiator.ObjectInstantiator;
/**
* The simplest instantiator - simply calls Class.newInstance(). This can deal with default public
* constructors, but that's about it.
*
* @see ObjectInstantiator
*/
public class NewInstanceInstantiator implements ObjectInstantiator {
private final Class type;
public NewInstanceInstantiator(Class type) {
this.type = type;
}
public Object newInstance() {
try {
return type.newInstance();
}
catch(Exception e) {
throw new ObjenesisException(e);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy