01: /*
02: * Copyright 2004 Clinton Begin
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
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 com.ibatis.sqlmap.engine.exchange;
17:
18: import com.ibatis.sqlmap.engine.cache.CacheKey;
19: import com.ibatis.sqlmap.engine.mapping.parameter.ParameterMap;
20: import com.ibatis.sqlmap.engine.mapping.result.ResultMap;
21: import com.ibatis.sqlmap.engine.scope.RequestScope;
22:
23: import java.util.Map;
24:
25: /**
26: * Interface for exchanging data between a parameter map/result map and the related objects
27: */
28: public interface DataExchange {
29:
30: /**
31: * Initializes the data exchange instance.
32: *
33: * @param properties
34: */
35: public void initialize(Map properties);
36:
37: /**
38: * Gets a data array from a parameter object.
39: *
40: * @param request - the scope of the request
41: * @param parameterMap - the parameter map
42: * @param parameterObject - the parameter object
43: *
44: * @return - the objects
45: */
46: public Object[] getData(RequestScope request,
47: ParameterMap parameterMap, Object parameterObject);
48:
49: /**
50: * Sets values from a data array into a result object.
51: *
52: * @param request - the request scope
53: * @param resultMap - the result map
54: * @param resultObject - the result object
55: * @param values - the values to be mapped
56: *
57: * @return the resultObject
58: */
59: public Object setData(RequestScope request, ResultMap resultMap,
60: Object resultObject, Object[] values);
61:
62: /**
63: * Sets values from a data array into a parameter object
64: *
65: * @param request - the request scope
66: * @param parameterMap - the parameter map
67: * @param parameterObject - the parameter object
68: * @param values - the values to set
69: *
70: * @return parameterObject
71: */
72: public Object setData(RequestScope request,
73: ParameterMap parameterMap, Object parameterObject,
74: Object[] values);
75:
76: /**
77: * Returns an object capable of being a unique cache key for a parameter object.
78: *
79: * @param request - the request scope
80: * @param parameterMap - the parameter map
81: * @param parameterObject - the parameter object
82: *
83: * @return - a cache key
84: */
85: public CacheKey getCacheKey(RequestScope request,
86: ParameterMap parameterMap, Object parameterObject);
87:
88: }
|