01: package org.drools.objenesis;
02:
03: import org.drools.objenesis.instantiator.ObjectInstantiator;
04:
05: /**
06: * Common interface to all kind of Objenesis objects
07: *
08: * @author Henri Tremblay
09: */
10: public interface Objenesis {
11:
12: /**
13: * Will create a new object without any constructor being called
14: *
15: * @param clazz Class to instantiate
16: * @return New instance of clazz
17: */
18: Object newInstance(Class clazz);
19:
20: /**
21: * Will pick the best instantiator for the provided class. If you need to create a lot of
22: * instances from the same class, it is way more efficient to create them from the same
23: * ObjectInstantiator than calling {@link #newInstance(Class)}.
24: *
25: * @param clazz Class to instantiate
26: * @return Instantiator dedicated to the class
27: */
28: ObjectInstantiator getInstantiatorOf(Class clazz);
29: }
|