1/**
2 * Copyright 2006-2017 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 <T> Type instantiated
31    * @param clazz Class to instantiate
32    * @return New instance of clazz
33    */
34   <T> T newInstance(Class<T> clazz);
35
36   /**
37    * Will pick the best instantiator for the provided class. If you need to create a lot of
38    * instances from the same class, it is way more efficient to create them from the same
39    * ObjectInstantiator than calling {@link #newInstance(Class)}.
40    *
41    * @param <T> Type to instantiate
42    * @param clazz Class to instantiate
43    * @return Instantiator dedicated to the class
44    */
45   <T> ObjectInstantiator<T> getInstantiatorOf(Class<T> clazz);
46}
47