View Javadoc
1   /*
2    *    Copyright 2009-2024 the original author or authors.
3    *
4    *    Licensed under the Apache License, Version 2.0 (the "License");
5    *    you may not use this file except in compliance with the License.
6    *    You may obtain a copy of the License at
7    *
8    *       https://www.apache.org/licenses/LICENSE-2.0
9    *
10   *    Unless required by applicable law or agreed to in writing, software
11   *    distributed under the License is distributed on an "AS IS" BASIS,
12   *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   *    See the License for the specific language governing permissions and
14   *    limitations under the License.
15   */
16  package org.apache.ibatis.submitted.custom_collection_handling;
17  
18  import java.util.List;
19  
20  import org.apache.ibatis.reflection.MetaObject;
21  import org.apache.ibatis.reflection.factory.ObjectFactory;
22  import org.apache.ibatis.reflection.property.PropertyTokenizer;
23  import org.apache.ibatis.reflection.wrapper.ObjectWrapper;
24  
25  public class CustomObjectWrapper implements ObjectWrapper {
26  
27    private final CustomCollection collection;
28  
29    public CustomObjectWrapper(CustomCollection collection) {
30      this.collection = collection;
31    }
32  
33    @Override
34    public Object get(PropertyTokenizer prop) {
35      // Not Implemented
36      return null;
37    }
38  
39    @Override
40    public void set(PropertyTokenizer prop, Object value) {
41      // Not Implemented
42    }
43  
44    @Override
45    public String findProperty(String name, boolean useCamelCaseMapping) {
46      // Not Implemented
47      return null;
48    }
49  
50    @Override
51    public String[] getGetterNames() {
52      // Not Implemented
53      return null;
54    }
55  
56    @Override
57    public String[] getSetterNames() {
58      // Not Implemented
59      return null;
60    }
61  
62    @Override
63    public Class<?> getSetterType(String name) {
64      // Not Implemented
65      return null;
66    }
67  
68    @Override
69    public Class<?> getGetterType(String name) {
70      // Not Implemented
71      return null;
72    }
73  
74    @Override
75    public boolean hasSetter(String name) {
76      // Not Implemented
77      return false;
78    }
79  
80    @Override
81    public boolean hasGetter(String name) {
82      // Not Implemented
83      return false;
84    }
85  
86    @Override
87    public MetaObject instantiatePropertyValue(String name, PropertyTokenizer prop, ObjectFactory objectFactory) {
88      // Not Implemented
89      return null;
90    }
91  
92    @Override
93    public boolean isCollection() {
94      return true;
95    }
96  
97    @Override
98    public void add(Object element) {
99      ((CustomCollection<Object>) collection).add(element);
100   }
101 
102   @Override
103   public <E> void addAll(List<E> element) {
104     ((CustomCollection<Object>) collection).addAll(element);
105   }
106 
107 }