Author: cbegin Date: Sat Jun 20 15:59:47 2009 New Revision: 786846 URL: http://svn.apache.org/viewvc?rev=786846&view=rev Log: added dynamic parameter class
Added: ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/executor/DynamicParameter.java Added: ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/executor/DynamicParameter.java URL: http://svn.apache.org/viewvc/ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/executor/DynamicParameter.java?rev=786846&view=auto ============================================================================== --- ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/executor/DynamicParameter.java (added) +++ ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/executor/DynamicParameter.java Sat Jun 20 15:59:47 2009 @@ -0,0 +1,37 @@ +package org.apache.ibatis.executor; + +import org.apache.ibatis.reflection.MetaObject; + +import java.util.*; + +public class DynamicParameter { + + private MetaObject metaObject; + private DynamicParameter parameterObject; + private Map<String, Object> dynamicProperties; + + public DynamicParameter(DynamicParameter parameterObject) { + this.metaObject = MetaObject.forObject(parameterObject); + this.parameterObject = parameterObject; + this.dynamicProperties = new HashMap<String,Object>(); + } + + public Object getParameterObject() { + return parameterObject; + } + + public void setValue(String name, Object value) { + dynamicProperties.put(name,value); + } + + public Object getValue(String name) { + if (dynamicProperties.containsKey(name)) { + return dynamicProperties.get(name); + } else { + return metaObject.getValue(name); + } + } + + + +}