@SuppressWarnings("rawtypes") public Object convert(Class destClass, Object srcObj) { // Boolean to Int not supported in apache common's int converter and this is why this class is req'd if (Boolean.class.isAssignableFrom(srcObj.getClass())) { boolean value = (Boolean)srcObj; return value ? (short)1 : (short)0; } else if (MappingUtils.isEnumType(srcObj.getClass())) { return ((Integer)((Enum)srcObj).ordinal()).shortValue(); } else { return commonsConverter.convert(destClass, srcObj); } } }
@SuppressWarnings("rawtypes") public Object convert(Class destClass, Object srcObj) { // Boolean to Int not supported in apache common's int converter and this is why this class is req'd if (Boolean.class.isAssignableFrom(srcObj.getClass())) { boolean value = (Boolean) srcObj; return (value ? (short) 1 : (short) 0); } else if (MappingUtils.isEnumType(srcObj.getClass())) { return ((Integer) ((Enum) srcObj).ordinal()).shortValue(); } else { return commonsConverter.convert(destClass, srcObj); } }
@SuppressWarnings("rawtypes") public Object convert(Class destClass, Object srcObj) { // Boolean to Int not supported in apache common's int converter and this is why this class is req'd if (Boolean.class.isAssignableFrom(srcObj.getClass())) { boolean value = (Boolean)srcObj; return value ? (short)1 : (short)0; } else if (MappingUtils.isEnumType(srcObj.getClass())) { return ((Integer)((Enum)srcObj).ordinal()).shortValue(); } else { return commonsConverter.convert(destClass, srcObj); } } }