You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ibatis.apache.org by ib...@incubator.apache.org on 2005/03/08 08:06:29 UTC
[Apache iBATIS Wiki] Updated: How do I use a Custom Type Handler with complex property (Type Safe Enumeration)
Date: 2005-03-07T23:06:29
Editor: NathanMaves
Wiki: Apache iBATIS Wiki
Page: How do I use a Custom Type Handler with complex property (Type Safe Enumeration)
URL: http://wiki.apache.org/ibatis/How do I use a Custom Type Handler with complex property (Type Safe Enumeration)
Fixed the getResult of the CTH.
Change Log:
------------------------------------------------------------------------------
@@ -83,7 +83,7 @@
case FC_WEEKLY: return WEEKLY;
case FC_MONTHLY: return MONTHLY;
case FC_QUARTERLY: return QUARTERLY;
- default: return null;
+ default: throw new IllegalArgumentException(value + " is not a valid Frequency");
}
}
@@ -120,9 +120,10 @@
public class FrequencyTypeHandler implements TypeHandlerCallback {
public Object getResult(ResultGetter getter) throws SQLException {
+ int value = getter.getInt();
if (getter.wasNull())
return null;
- return Frequency.get(getter.getInt());
+ return Frequency.get(value);
}
public void setParameter(ParameterSetter setter, Object parameter) throws SQLException {