当前位置: 首页>>代码示例>>Java>>正文


Java ObjectFactory类代码示例

本文整理汇总了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));
}
 
开发者ID:cvent,项目名称:dropwizard-mybatis,代码行数:30,代码来源:DefaultSqlSessionFactoryProvider.java

示例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);
  }
}
 
开发者ID:yuexiahandao,项目名称:MybatisCode,代码行数:19,代码来源:MetaObject.java

示例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;
}
 
开发者ID:yinshipeng,项目名称:sosoapi-base,代码行数:19,代码来源:BeanWrapper.java

示例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);
  }
}
 
开发者ID:shurun19851206,项目名称:mybaties,代码行数:23,代码来源:MetaObject.java

示例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);
    }
}
 
开发者ID:Caratacus,项目名称:mybatis-plus-mini,代码行数:10,代码来源:MybatisXMLConfigBuilder.java

示例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);
  }
}
 
开发者ID:Alfresco,项目名称:alfresco-core,代码行数:10,代码来源:HierarchicalXMLConfigBuilder.java

示例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;
}
 
开发者ID:yuexiahandao,项目名称:MybatisCode,代码行数:14,代码来源:BeanWrapper.java

示例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);
  }
}
 
开发者ID:yuexiahandao,项目名称:MybatisCode,代码行数:8,代码来源:MetaObject.java

示例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()]);
}
 
开发者ID:yuexiahandao,项目名称:MybatisCode,代码行数:13,代码来源:AbstractSerialStateHolder.java

示例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);
}
 
开发者ID:yuexiahandao,项目名称:MybatisCode,代码行数:9,代码来源:JavassistSerialStateHolder.java

示例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;
}
 
开发者ID:yuexiahandao,项目名称:MybatisCode,代码行数:10,代码来源:JavassistProxyFactory.java

示例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;
}
 
开发者ID:yuexiahandao,项目名称:MybatisCode,代码行数:8,代码来源:JavassistProxyFactory.java

示例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);
}
 
开发者ID:yuexiahandao,项目名称:MybatisCode,代码行数:9,代码来源:CglibSerialStateHolder.java

示例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;
}
 
开发者ID:yuexiahandao,项目名称:MybatisCode,代码行数:11,代码来源:AbstractEnhancedDeserializationProxy.java

示例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;
}
 
开发者ID:yuexiahandao,项目名称:MybatisCode,代码行数:9,代码来源:DefaultMapResultHandler.java


注:本文中的org.apache.ibatis.reflection.factory.ObjectFactory类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。