1 16 package com.ibatis.sqlmap.engine.exchange; 17 18 import com.ibatis.sqlmap.engine.mapping.parameter.ParameterMap; 19 import com.ibatis.sqlmap.engine.mapping.parameter.ParameterMapping; 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 28 public class PrimitiveDataExchange extends BaseDataExchange implements DataExchange { 29 30 protected PrimitiveDataExchange(DataExchangeFactory dataExchangeFactory) { 31 super(dataExchangeFactory); 32 } 33 34 public void initialize(Map properties) { 35 } 36 37 public Object [] getData(RequestScope request, ParameterMap parameterMap, Object parameterObject) { 38 ParameterMapping[] mappings = parameterMap.getParameterMappings(); 39 Object [] data = new Object [mappings.length]; 40 for (int i = 0; i < mappings.length; i++) { 41 data[i] = parameterObject; 42 } 43 return data; 44 } 45 46 public Object setData(RequestScope request, ResultMap resultMap, Object resultObject, Object [] values) { 47 return values[0]; 48 } 49 50 public Object setData(RequestScope request, ParameterMap parameterMap, Object parameterObject, Object [] values) { 51 return values[0]; 52 } 53 54 } 55 | Popular Tags |