1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.apache.ibatis.mapping;
17
18 import java.util.HashMap;
19 import java.util.List;
20 import java.util.Map;
21
22 import org.apache.ibatis.reflection.MetaObject;
23 import org.apache.ibatis.reflection.property.PropertyTokenizer;
24 import org.apache.ibatis.session.Configuration;
25
26
27
28
29
30
31
32
33
34
35
36
37 public class BoundSql {
38
39 private String sql;
40 private List<ParameterMapping> parameterMappings;
41 private Object parameterObject;
42 private Map<String, Object> additionalParameters;
43 private MetaObject metaParameters;
44
45 public BoundSql(Configuration configuration, String sql, List<ParameterMapping> parameterMappings, Object parameterObject) {
46 this.sql = sql;
47 this.parameterMappings = parameterMappings;
48 this.parameterObject = parameterObject;
49 this.additionalParameters = new HashMap<String, Object>();
50 this.metaParameters = configuration.newMetaObject(additionalParameters);
51 }
52
53 public String getSql() {
54 return sql;
55 }
56
57 public List<ParameterMapping> getParameterMappings() {
58 return parameterMappings;
59 }
60
61 public Object getParameterObject() {
62 return parameterObject;
63 }
64
65 public boolean hasAdditionalParameter(String name) {
66 PropertyTokenizer prop = new PropertyTokenizer(name);
67 String indexedName = prop.getIndexedName();
68 return additionalParameters.containsKey(indexedName);
69 }
70
71 public void setAdditionalParameter(String name, Object value) {
72 metaParameters.setValue(name, value);
73 }
74
75 public Object getAdditionalParameter(String name) {
76 return metaParameters.getValue(name);
77 }
78 }