1/**
2 * Copyright 2006-2013 the original author or authors.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *     http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16package org.objenesis;
17
18import org.objenesis.instantiator.ObjectInstantiator;
19
20/**
21 * Common interface to all kind of Objenesis objects
22 *
23 * @author Henri Tremblay
24 */
25public interface Objenesis {
26
27   /**
28    * Will create a new object without any constructor being called
29    *
30    * @param clazz Class to instantiate
31    * @return New instance of clazz
32    */
33   Object newInstance(Class clazz);
34
35   /**
36    * Will pick the best instantiator for the provided class. If you need to create a lot of
37    * instances from the same class, it is way more efficient to create them from the same
38    * ObjectInstantiator than calling {@link #newInstance(Class)}.
39    *
40    * @param clazz Class to instantiate
41    * @return Instantiator dedicated to the class
42    */
43   ObjectInstantiator getInstantiatorOf(Class clazz);
44}
45