/* * Copyright 2009-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.ibatis.reflection.factory; import java.util.List; import java.util.Properties; /** * MyBatis uses an ObjectFactory to create all needed new Objects. * * @author Clinton Begin */ /** * 对象工厂,所有对象都要由工厂来产生 * */ public interface ObjectFactory { /** * Sets configuration properties. * 设置属性 * @param properties configuration properties */ void setProperties(Properties properties); /** * Creates a new object with default constructor. * 生产对象 * @param type Object type * @return */ <T> T create(Class<T> type); /** * Creates a new object with the specified constructor and params. * 生产对象,使用指定的构造函数和构造函数参数 * @param type Object type * @param constructorArgTypes Constructor argument types * @param constructorArgs Constructor argument values * @return */ <T> T create(Class<T> type, List<Class<?>> constructorArgTypes, List<Object> constructorArgs); /** * Returns true if this object can have a set of other objects. * It's main purpose is to support non-java.util.Collection objects like Scala collections. * 返回这个对象是否是集合,为了支持Scala collections? * * @since 3.1.0 * @param type Object type * @return whether it is a collection or not */ <T> boolean isCollection(Class<T> type); }