<<Back to http://devdoc.net
Mine with nofee-ng to get DevFee back!
View Javadoc
1   /**
2    *    Copyright 2009-2015 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    *       http://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.reflection.wrapper;
17  
18  import java.util.Collection;
19  import java.util.List;
20  
21  import org.apache.ibatis.reflection.MetaObject;
22  import org.apache.ibatis.reflection.factory.ObjectFactory;
23  import org.apache.ibatis.reflection.property.PropertyTokenizer;
24  
25  /**
26   * @author Clinton Begin
27   */
28  public class CollectionWrapper implements ObjectWrapper {
29  
30    private Collection<Object> object;
31  
32    public CollectionWrapper(MetaObject metaObject, Collection<Object> object) {
33      this.object = object;
34    }
35  
36    @Override
37    public Object get(PropertyTokenizer prop) {
38      throw new UnsupportedOperationException();
39    }
40  
41    @Override
42    public void set(PropertyTokenizer prop, Object value) {
43      throw new UnsupportedOperationException();
44    }
45  
46    @Override
47    public String findProperty(String name, boolean useCamelCaseMapping) {
48      throw new UnsupportedOperationException();
49    }
50  
51    @Override
52    public String[] getGetterNames() {
53      throw new UnsupportedOperationException();
54    }
55  
56    @Override
57    public String[] getSetterNames() {
58      throw new UnsupportedOperationException();
59    }
60  
61    @Override
62    public Class<?> getSetterType(String name) {
63      throw new UnsupportedOperationException();
64    }
65  
66    @Override
67    public Class<?> getGetterType(String name) {
68      throw new UnsupportedOperationException();
69    }
70  
71    @Override
72    public boolean hasSetter(String name) {
73      throw new UnsupportedOperationException();
74    }
75  
76    @Override
77    public boolean hasGetter(String name) {
78      throw new UnsupportedOperationException();
79    }
80  
81    @Override
82    public MetaObject instantiatePropertyValue(String name, PropertyTokenizer prop, ObjectFactory objectFactory) {
83      throw new UnsupportedOperationException();
84    }
85  
86    @Override
87    public boolean isCollection() {
88      return true;
89    }
90  
91    @Override
92    public void add(Object element) {
93      object.add(element);
94    }
95  
96    @Override
97    public <E> void addAll(List<E> element) {
98      object.addAll(element);
99    }
100 
101 }