178c496fe0fac4c89993109340aec80d1afa3141fIan Parkinson/** 278c496fe0fac4c89993109340aec80d1afa3141fIan Parkinson * Copyright 2006-2013 the original author or authors. 378c496fe0fac4c89993109340aec80d1afa3141fIan Parkinson * 478c496fe0fac4c89993109340aec80d1afa3141fIan Parkinson * Licensed under the Apache License, Version 2.0 (the "License"); 578c496fe0fac4c89993109340aec80d1afa3141fIan Parkinson * you may not use this file except in compliance with the License. 678c496fe0fac4c89993109340aec80d1afa3141fIan Parkinson * You may obtain a copy of the License at 778c496fe0fac4c89993109340aec80d1afa3141fIan Parkinson * 878c496fe0fac4c89993109340aec80d1afa3141fIan Parkinson * http://www.apache.org/licenses/LICENSE-2.0 978c496fe0fac4c89993109340aec80d1afa3141fIan Parkinson * 1078c496fe0fac4c89993109340aec80d1afa3141fIan Parkinson * Unless required by applicable law or agreed to in writing, software 1178c496fe0fac4c89993109340aec80d1afa3141fIan Parkinson * distributed under the License is distributed on an "AS IS" BASIS, 1278c496fe0fac4c89993109340aec80d1afa3141fIan Parkinson * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1378c496fe0fac4c89993109340aec80d1afa3141fIan Parkinson * See the License for the specific language governing permissions and 1478c496fe0fac4c89993109340aec80d1afa3141fIan Parkinson * limitations under the License. 1578c496fe0fac4c89993109340aec80d1afa3141fIan Parkinson */ 1678c496fe0fac4c89993109340aec80d1afa3141fIan Parkinsonpackage org.objenesis; 1778c496fe0fac4c89993109340aec80d1afa3141fIan Parkinson 1878c496fe0fac4c89993109340aec80d1afa3141fIan Parkinsonimport org.objenesis.instantiator.ObjectInstantiator; 1978c496fe0fac4c89993109340aec80d1afa3141fIan Parkinson 2078c496fe0fac4c89993109340aec80d1afa3141fIan Parkinson/** 2178c496fe0fac4c89993109340aec80d1afa3141fIan Parkinson * Common interface to all kind of Objenesis objects 2278c496fe0fac4c89993109340aec80d1afa3141fIan Parkinson * 2378c496fe0fac4c89993109340aec80d1afa3141fIan Parkinson * @author Henri Tremblay 2478c496fe0fac4c89993109340aec80d1afa3141fIan Parkinson */ 2578c496fe0fac4c89993109340aec80d1afa3141fIan Parkinsonpublic interface Objenesis { 2678c496fe0fac4c89993109340aec80d1afa3141fIan Parkinson 2778c496fe0fac4c89993109340aec80d1afa3141fIan Parkinson /** 2878c496fe0fac4c89993109340aec80d1afa3141fIan Parkinson * Will create a new object without any constructor being called 2978c496fe0fac4c89993109340aec80d1afa3141fIan Parkinson * 3078c496fe0fac4c89993109340aec80d1afa3141fIan Parkinson * @param clazz Class to instantiate 3178c496fe0fac4c89993109340aec80d1afa3141fIan Parkinson * @return New instance of clazz 3278c496fe0fac4c89993109340aec80d1afa3141fIan Parkinson */ 3378c496fe0fac4c89993109340aec80d1afa3141fIan Parkinson Object newInstance(Class clazz); 3478c496fe0fac4c89993109340aec80d1afa3141fIan Parkinson 3578c496fe0fac4c89993109340aec80d1afa3141fIan Parkinson /** 3678c496fe0fac4c89993109340aec80d1afa3141fIan Parkinson * Will pick the best instantiator for the provided class. If you need to create a lot of 3778c496fe0fac4c89993109340aec80d1afa3141fIan Parkinson * instances from the same class, it is way more efficient to create them from the same 3878c496fe0fac4c89993109340aec80d1afa3141fIan Parkinson * ObjectInstantiator than calling {@link #newInstance(Class)}. 3978c496fe0fac4c89993109340aec80d1afa3141fIan Parkinson * 4078c496fe0fac4c89993109340aec80d1afa3141fIan Parkinson * @param clazz Class to instantiate 4178c496fe0fac4c89993109340aec80d1afa3141fIan Parkinson * @return Instantiator dedicated to the class 4278c496fe0fac4c89993109340aec80d1afa3141fIan Parkinson */ 4378c496fe0fac4c89993109340aec80d1afa3141fIan Parkinson ObjectInstantiator getInstantiatorOf(Class clazz); 4478c496fe0fac4c89993109340aec80d1afa3141fIan Parkinson} 45