View Javadoc
1   /*
2    *    Copyright 2009-2023 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  
24  public class CustomObjectWrapper implements org.apache.ibatis.reflection.wrapper.ObjectWrapper {
25  
26    private final CustomCollection collection;
27  
28    public CustomObjectWrapper(CustomCollection collection) {
29      this.collection = collection;
30    }
31  
32    @Override
33    public Object get(PropertyTokenizer prop) {
34      // Not Implemented
35      return null;
36    }
37  
38    @Override
39    public void set(PropertyTokenizer prop, Object value) {
40      // Not Implemented
41    }
42  
43    @Override
44    public String findProperty(String name, boolean useCamelCaseMapping) {
45      // Not Implemented
46      return null;
47    }
48  
49    @Override
50    public String[] getGetterNames() {
51      // Not Implemented
52      return null;
53    }
54  
55    @Override
56    public String[] getSetterNames() {
57      // Not Implemented
58      return null;
59    }
60  
61    @Override
62    public Class<?> getSetterType(String name) {
63      // Not Implemented
64      return null;
65    }
66  
67    @Override
68    public Class<?> getGetterType(String name) {
69      // Not Implemented
70      return null;
71    }
72  
73    @Override
74    public boolean hasSetter(String name) {
75      // Not Implemented
76      return false;
77    }
78  
79    @Override
80    public boolean hasGetter(String name) {
81      // Not Implemented
82      return false;
83    }
84  
85    @Override
86    public MetaObject instantiatePropertyValue(String name, PropertyTokenizer prop, ObjectFactory objectFactory) {
87      // Not Implemented
88      return null;
89    }
90  
91    @Override
92    public boolean isCollection() {
93      return true;
94    }
95  
96    @Override
97    public void add(Object element) {
98      ((CustomCollection<Object>) collection).add(element);
99    }
100 
101   @Override
102   public <E> void addAll(List<E> element) {
103     ((CustomCollection<Object>) collection).addAll(element);
104   }
105 
106 }