1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.apache.ibatis.domain.misc;
17
18 import org.apache.ibatis.domain.blog.Author;
19 import org.apache.ibatis.reflection.MetaObject;
20 import org.apache.ibatis.reflection.wrapper.ObjectWrapper;
21 import org.apache.ibatis.reflection.wrapper.ObjectWrapperFactory;
22
23 public class CustomBeanWrapperFactory implements ObjectWrapperFactory {
24 @Override
25 public boolean hasWrapperFor(Object object) {
26 if (object instanceof Author) {
27 return true;
28 }
29 return false;
30 }
31
32 @Override
33 public ObjectWrapper getWrapperFor(MetaObject metaObject, Object object) {
34 return new CustomBeanWrapper(metaObject, object);
35 }
36 }