Using java.lang.Number with MyBatis mapper

I just upgraded my MyBatis version from 3.1.0 to 3.4.6 and started having the following problem. I have a class with parameters that I pass to the MyBatis mapper. One of the parameters is a java.lang.Number. The reason is that sometimes holds an int and sometimes it holds a double. With the previous version of MyBatis, it worked fine. With this one, I'm getting:

java.lang.IllegalStateException: Type handler was null on parameter mapping for 
property '__frch_searchFilter_1.valueNum1'. It was either not specified and/or could 
not be found for the javaType (java.lang.Number) : jdbcType (null) combination.

The mapper accesses the value like so:


And the field is defined in the class like so:

private Number valueNum1;

Is there a way to use java.lang.Number and have MyBatis figure out whether it should use DoubleTypeHandler or IntegerTypeHandler based on the underlying class/data?