org.apache.ibatis.reflection.wrapper.ObjectWrapperFactory Java Examples
The following examples show how to use
org.apache.ibatis.reflection.wrapper.ObjectWrapperFactory.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MetaObject.java From mybaties with Apache License 2.0 | 6 votes |
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); } }
Example #2
Source File: MetaObject.java From mybatis with Apache License 2.0 | 6 votes |
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); } }
Example #3
Source File: XMLConfigBuilder.java From mybaties with Apache License 2.0 | 5 votes |
private void objectWrapperFactoryElement(XNode context) throws Exception { if (context != null) { String type = context.getStringAttribute("type"); ObjectWrapperFactory factory = (ObjectWrapperFactory) resolveClass(type).newInstance(); configuration.setObjectWrapperFactory(factory); } }
Example #4
Source File: XMLConfigBuilder.java From QuickProject with Apache License 2.0 | 5 votes |
private void objectWrapperFactoryElement(XNode context) throws Exception { if (context != null) { String type = context.getStringAttribute("type"); ObjectWrapperFactory factory = (ObjectWrapperFactory) resolveClass(type).newInstance(); configuration.setObjectWrapperFactory(factory); } }
Example #5
Source File: DefaultMapResultHandler.java From mybatis with Apache License 2.0 | 5 votes |
@SuppressWarnings("unchecked") public DefaultMapResultHandler(String mapKey, ObjectFactory objectFactory, ObjectWrapperFactory objectWrapperFactory) { this.objectFactory = objectFactory; this.objectWrapperFactory = objectWrapperFactory; this.mappedResults = objectFactory.create(Map.class); this.mapKey = mapKey; }
Example #6
Source File: XMLConfigBuilder.java From mybatis with Apache License 2.0 | 5 votes |
private void objectWrapperFactoryElement(XNode context) throws Exception { if (context != null) { String type = context.getStringAttribute("type"); ObjectWrapperFactory factory = (ObjectWrapperFactory) resolveClass(type).newInstance(); configuration.setObjectWrapperFactory(factory); } }
Example #7
Source File: MetaObject.java From mybatis with Apache License 2.0 | 5 votes |
public static MetaObject forObject(Object object, ObjectFactory objectFactory, ObjectWrapperFactory objectWrapperFactory) { if (object == null) { //处理一下null,将null包装起来 return SystemMetaObject.NULL_META_OBJECT; } else { return new MetaObject(object, objectFactory, objectWrapperFactory); } }
Example #8
Source File: DefaultMapResultHandler.java From mybaties with Apache License 2.0 | 5 votes |
@SuppressWarnings("unchecked") public DefaultMapResultHandler(String mapKey, ObjectFactory objectFactory, ObjectWrapperFactory objectWrapperFactory) { this.objectFactory = objectFactory; this.objectWrapperFactory = objectWrapperFactory; this.mappedResults = objectFactory.create(Map.class); this.mapKey = mapKey; }
Example #9
Source File: MetaObject.java From mybaties with Apache License 2.0 | 5 votes |
public static MetaObject forObject(Object object, ObjectFactory objectFactory, ObjectWrapperFactory objectWrapperFactory) { if (object == null) { //处理一下null,将null包装起来 return SystemMetaObject.NULL_META_OBJECT; } else { return new MetaObject(object, objectFactory, objectWrapperFactory); } }
Example #10
Source File: HierarchicalXMLConfigBuilder.java From alfresco-repository with GNU Lesser General Public License v3.0 | 5 votes |
private void objectWrapperFactoryElement(XNode context) throws Exception { if (context != null) { String type = context.getStringAttribute("type"); ObjectWrapperFactory factory = (ObjectWrapperFactory) resolveClass(type).newInstance(); configuration.setObjectWrapperFactory(factory); } }
Example #11
Source File: Configuration.java From mybaties with Apache License 2.0 | 4 votes |
public ObjectWrapperFactory getObjectWrapperFactory() { return objectWrapperFactory; }
Example #12
Source File: Configuration.java From mybaties with Apache License 2.0 | 4 votes |
public void setObjectWrapperFactory(ObjectWrapperFactory objectWrapperFactory) { this.objectWrapperFactory = objectWrapperFactory; }
Example #13
Source File: MetaObject.java From mybaties with Apache License 2.0 | 4 votes |
public ObjectWrapperFactory getObjectWrapperFactory() { return objectWrapperFactory; }
Example #14
Source File: Configuration.java From Shop-for-JavaWeb with MIT License | 4 votes |
public void setObjectWrapperFactory( ObjectWrapperFactory objectWrapperFactory) { this.objectWrapperFactory = objectWrapperFactory; }
Example #15
Source File: MetaObject.java From mybatis with Apache License 2.0 | 4 votes |
public ObjectWrapperFactory getObjectWrapperFactory() { return objectWrapperFactory; }
Example #16
Source File: Configuration.java From mybatis with Apache License 2.0 | 4 votes |
public ObjectWrapperFactory getObjectWrapperFactory() { return objectWrapperFactory; }
Example #17
Source File: Configuration.java From mybatis with Apache License 2.0 | 4 votes |
public void setObjectWrapperFactory(ObjectWrapperFactory objectWrapperFactory) { this.objectWrapperFactory = objectWrapperFactory; }
Example #18
Source File: Configuration.java From Shop-for-JavaWeb with MIT License | 4 votes |
public ObjectWrapperFactory getObjectWrapperFactory() { return objectWrapperFactory; }
Example #19
Source File: HierarchicalSqlSessionFactoryBean.java From alfresco-repository with GNU Lesser General Public License v3.0 | 2 votes |
/** * Sets the ObjectWrapperFactory. * * @since 1.1.2 * @param objectWrapperFactory ObjectWrapperFactory */ public void setObjectWrapperFactory(ObjectWrapperFactory objectWrapperFactory) { this.objectWrapperFactory = objectWrapperFactory; }
Example #20
Source File: SqlSessionFactoryBean.java From Shop-for-JavaWeb with MIT License | 2 votes |
/** * Sets the ObjectWrapperFactory. * * @since 1.1.2 * @param objectWrapperFactory */ public void setObjectWrapperFactory( ObjectWrapperFactory objectWrapperFactory) { this.objectWrapperFactory = objectWrapperFactory; }
Example #21
Source File: SqlSessionFactoryBean.java From QuickProject with Apache License 2.0 | 2 votes |
/** * Sets the ObjectWrapperFactory. * * @since 1.1.2 * @param objectWrapperFactory */ public void setObjectWrapperFactory(ObjectWrapperFactory objectWrapperFactory) { this.objectWrapperFactory = objectWrapperFactory; }