本文整理汇总了Java中org.apache.ibatis.reflection.factory.ObjectFactory类的典型用法代码示例。如果您正苦于以下问题:Java ObjectFactory类的具体用法?Java ObjectFactory怎么用?Java ObjectFactory使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ObjectFactory类属于org.apache.ibatis.reflection.factory包,在下文中一共展示了ObjectFactory类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: DefaultSqlSessionFactoryProvider
import org.apache.ibatis.reflection.factory.ObjectFactory; //导入依赖的package包/类
/**
* Create a new provider instance
*
* @param dropwizardEnvironment The dropwizard environment object
* @param applicationName The application name
* @param dataSourceFactories The MultiEnvAware datasource list used to create session factories from
* @param typeHandlers The list of type handlers to configure with each session factory
* @param sqlMappers The list of sql mappers to configure with each session factory
*/
private DefaultSqlSessionFactoryProvider(Environment dropwizardEnvironment,
String applicationName,
MultiEnvAware<ConfigurableLazyDataSourceFactory> dataSourceFactories,
List<Class<?>> typeHandlers,
List<Class<?>> sqlMappers,
Map<Class<?>, Class<?>> typeClassToTypeHandlerClassMap,
Map<String, Class<?>> typeToAliasClassMap,
ObjectFactory objectFactory,
Map<String, Object> mybatisConfigurationSettingsMap) {
this.dropwizardEnvironment = dropwizardEnvironment;
this.applicationName = applicationName;
this.dataSourceFactories = dataSourceFactories;
this.typeHandlers = typeHandlers;
this.sqlMappers = sqlMappers;
this.typeClassToTypeHandlerClassMap = typeClassToTypeHandlerClassMap;
this.typeToAliasClassMap = typeToAliasClassMap;
this.objectFactory = objectFactory;
this.mybatisConfigurationSettings = mybatisConfigurationSettingsMap;
sessionFactories = dataSourceFactories.convert((env, dataSource) -> buildSessionFactory(dataSource, env));
}
示例2: MetaObject
import org.apache.ibatis.reflection.factory.ObjectFactory; //导入依赖的package包/类
private MetaObject(Object object, ObjectFactory objectFactory, ObjectWrapperFactory objectWrapperFactory, ReflectorFactory reflectorFactory) {
this.originalObject = object;
this.objectFactory = objectFactory;
this.objectWrapperFactory = objectWrapperFactory;
this.reflectorFactory = reflectorFactory;
if (object instanceof ObjectWrapper) {
this.objectWrapper = (ObjectWrapper) object;
} else if (objectWrapperFactory.hasWrapperFor(object)) {
this.objectWrapper = objectWrapperFactory.getWrapperFor(this, object);
} else if (object instanceof Map) {
this.objectWrapper = new MapWrapper(this, (Map) object);
} else if (object instanceof Collection) {
this.objectWrapper = new CollectionWrapper(this, (Collection) object);
} else {
this.objectWrapper = new BeanWrapper(this, object);
}
}
示例3: instantiatePropertyValue
import org.apache.ibatis.reflection.factory.ObjectFactory; //导入依赖的package包/类
public MetaObject instantiatePropertyValue(String name,
PropertyTokenizer prop, ObjectFactory objectFactory) {
MetaObject metaValue;
Class<?> type = getSetterType(prop.getName());
try {
Object newObject = objectFactory.create(type);
metaValue = MetaObject.forObject(newObject,
metaObject.getObjectFactory(),
metaObject.getObjectWrapperFactory());
set(prop, newObject);
} catch (Exception e) {
throw new ReflectionException("Cannot set value of property '"
+ name + "' because '" + name
+ "' is null and cannot be instantiated on instance of "
+ type.getName() + ". Cause:" + e.toString(), e);
}
return metaValue;
}
示例4: MetaObject
import org.apache.ibatis.reflection.factory.ObjectFactory; //导入依赖的package包/类
private MetaObject(Object object, ObjectFactory objectFactory, ObjectWrapperFactory objectWrapperFactory) {
this.originalObject = object;
this.objectFactory = objectFactory;
this.objectWrapperFactory = objectWrapperFactory;
if (object instanceof ObjectWrapper) {
//如果对象本身已经是ObjectWrapper型,则直接赋给objectWrapper
this.objectWrapper = (ObjectWrapper) object;
} else if (objectWrapperFactory.hasWrapperFor(object)) {
//如果有包装器,调用ObjectWrapperFactory.getWrapperFor
this.objectWrapper = objectWrapperFactory.getWrapperFor(this, object);
} else if (object instanceof Map) {
//如果是Map型,返回MapWrapper
this.objectWrapper = new MapWrapper(this, (Map) object);
} else if (object instanceof Collection) {
//如果是Collection型,返回CollectionWrapper
this.objectWrapper = new CollectionWrapper(this, (Collection) object);
} else {
//除此以外,返回BeanWrapper
this.objectWrapper = new BeanWrapper(this, object);
}
}
示例5: objectFactoryElement
import org.apache.ibatis.reflection.factory.ObjectFactory; //导入依赖的package包/类
private void objectFactoryElement(XNode context) throws Exception {
if (context != null) {
String type = context.getStringAttribute("type");
Properties properties = context.getChildrenAsProperties();
ObjectFactory factory = (ObjectFactory) resolveClass(type).newInstance();
factory.setProperties(properties);
configuration.setObjectFactory(factory);
}
}
示例6: objectFactoryElement
import org.apache.ibatis.reflection.factory.ObjectFactory; //导入依赖的package包/类
private void objectFactoryElement(XNode context) throws Exception {
if (context != null) {
String type = context.getStringAttribute("type");
Properties properties = context.getChildrenAsProperties();
ObjectFactory factory = (ObjectFactory) resolveClass(type).newInstance();
factory.setProperties(properties);
configuration.setObjectFactory(factory);
}
}
示例7: instantiatePropertyValue
import org.apache.ibatis.reflection.factory.ObjectFactory; //导入依赖的package包/类
@Override
public MetaObject instantiatePropertyValue(String name, PropertyTokenizer prop, ObjectFactory objectFactory) {
MetaObject metaValue;
Class<?> type = getSetterType(prop.getName());
try {
Object newObject = objectFactory.create(type);
metaValue = MetaObject.forObject(newObject, metaObject.getObjectFactory(), metaObject.getObjectWrapperFactory(), metaObject.getReflectorFactory());
set(prop, newObject);
} catch (Exception e) {
throw new ReflectionException("Cannot set value of property '" + name + "' because '" + name + "' is null and cannot be instantiated on instance of " + type.getName() + ". Cause:" + e.toString(), e);
}
return metaValue;
}
示例8: forObject
import org.apache.ibatis.reflection.factory.ObjectFactory; //导入依赖的package包/类
public static MetaObject forObject(Object object, ObjectFactory objectFactory, ObjectWrapperFactory objectWrapperFactory, ReflectorFactory reflectorFactory) {
if (object == null) {
return SystemMetaObject.NULL_META_OBJECT;
} else {
return new MetaObject(object, objectFactory, objectWrapperFactory, reflectorFactory);
}
}
示例9: AbstractSerialStateHolder
import org.apache.ibatis.reflection.factory.ObjectFactory; //导入依赖的package包/类
public AbstractSerialStateHolder(
final Object userBean,
final Map<String, ResultLoaderMap.LoadPair> unloadedProperties,
final ObjectFactory objectFactory,
List<Class<?>> constructorArgTypes,
List<Object> constructorArgs) {
this.userBean = userBean;
this.unloadedProperties = new HashMap<String, ResultLoaderMap.LoadPair>(unloadedProperties);
this.objectFactory = objectFactory;
this.constructorArgTypes = constructorArgTypes.toArray(new Class<?>[constructorArgTypes.size()]);
this.constructorArgs = constructorArgs.toArray(new Object[constructorArgs.size()]);
}
示例10: JavassistSerialStateHolder
import org.apache.ibatis.reflection.factory.ObjectFactory; //导入依赖的package包/类
public JavassistSerialStateHolder(
final Object userBean,
final Map<String, ResultLoaderMap.LoadPair> unloadedProperties,
final ObjectFactory objectFactory,
List<Class<?>> constructorArgTypes,
List<Object> constructorArgs) {
super(userBean, unloadedProperties, objectFactory, constructorArgTypes, constructorArgs);
}
示例11: EnhancedResultObjectProxyImpl
import org.apache.ibatis.reflection.factory.ObjectFactory; //导入依赖的package包/类
private EnhancedResultObjectProxyImpl(Class<?> type, ResultLoaderMap lazyLoader, Configuration configuration, ObjectFactory objectFactory, List<Class<?>> constructorArgTypes, List<Object> constructorArgs) {
this.type = type;
this.lazyLoader = lazyLoader;
this.aggressive = configuration.isAggressiveLazyLoading();
this.lazyLoadTriggerMethods = configuration.getLazyLoadTriggerMethods();
this.objectFactory = objectFactory;
this.constructorArgTypes = constructorArgTypes;
this.constructorArgs = constructorArgs;
}
示例12: createProxy
import org.apache.ibatis.reflection.factory.ObjectFactory; //导入依赖的package包/类
public static Object createProxy(Object target, ResultLoaderMap lazyLoader, Configuration configuration, ObjectFactory objectFactory, List<Class<?>> constructorArgTypes, List<Object> constructorArgs) {
final Class<?> type = target.getClass();
EnhancedResultObjectProxyImpl callback = new EnhancedResultObjectProxyImpl(type, lazyLoader, configuration, objectFactory, constructorArgTypes, constructorArgs);
Object enhanced = crateProxy(type, callback, constructorArgTypes, constructorArgs);
PropertyCopier.copyBeanProperties(type, target, enhanced);
return enhanced;
}
示例13: CglibSerialStateHolder
import org.apache.ibatis.reflection.factory.ObjectFactory; //导入依赖的package包/类
public CglibSerialStateHolder(
final Object userBean,
final Map<String, ResultLoaderMap.LoadPair> unloadedProperties,
final ObjectFactory objectFactory,
List<Class<?>> constructorArgTypes,
List<Object> constructorArgs) {
super(userBean, unloadedProperties, objectFactory, constructorArgTypes, constructorArgs);
}
示例14: AbstractEnhancedDeserializationProxy
import org.apache.ibatis.reflection.factory.ObjectFactory; //导入依赖的package包/类
protected AbstractEnhancedDeserializationProxy(Class<?> type, Map<String, ResultLoaderMap.LoadPair> unloadedProperties,
ObjectFactory objectFactory, List<Class<?>> constructorArgTypes, List<Object> constructorArgs) {
this.type = type;
this.unloadedProperties = unloadedProperties;
this.objectFactory = objectFactory;
this.constructorArgTypes = constructorArgTypes;
this.constructorArgs = constructorArgs;
this.reloadingPropertyLock = new Object();
this.reloadingProperty = false;
}
示例15: DefaultMapResultHandler
import org.apache.ibatis.reflection.factory.ObjectFactory; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public DefaultMapResultHandler(String mapKey, ObjectFactory objectFactory, ObjectWrapperFactory objectWrapperFactory, ReflectorFactory reflectorFactory) {
this.objectFactory = objectFactory;
this.objectWrapperFactory = objectWrapperFactory;
this.reflectorFactory = reflectorFactory;
this.mappedResults = objectFactory.create(Map.class);
this.mapKey = mapKey;
}