public static Object getCastingValue ( ColumnType columnType , Object value ) throws ExecutionException { validateInput ( columnType ) ; Object returnValue = null ; if ( value != null ) { switch ( columnType . getDataType ( ) ) { case BIGINT : ensureNumber ( value ) ; returnValue = ( ( Number ) value ) . longValue ( ) ; break ; case DOUBLE : ensureNumber ( value ) ; returnValue = ( ( Number ) value ) . doubleValue ( ) ; break ; case FLOAT : ensureNumber ( value ) ; returnValue = ( ( Number ) value ) . floatValue ( ) ; break ; case INT : ensureNumber ( value ) ; returnValue = ( ( Number ) value ) . intValue ( ) ; break ; default : returnValue = value ; } } return returnValue ; }
Return a casting value adapt to columntType .