protected void columnToContentValue ( ContentValues contentValues , TColumn column , Object value ) { String columnName = column . getName ( ) ; if ( value instanceof Number ) { if ( value instanceof Byte ) { validateValue ( column , value , Byte . class , Short . class , Integer . class , Long . class ) ; contentValues . put ( columnName , ( Byte ) value ) ; } else if ( value instanceof Short ) { validateValue ( column , value , Short . class , Integer . class , Long . class ) ; contentValues . put ( columnName , ( Short ) value ) ; } else if ( value instanceof Integer ) { validateValue ( column , value , Integer . class , Long . class ) ; contentValues . put ( columnName , ( Integer ) value ) ; } else if ( value instanceof Long ) { validateValue ( column , value , Long . class , Double . class ) ; contentValues . put ( columnName , ( Long ) value ) ; } else if ( value instanceof Float ) { validateValue ( column , value , Float . class ) ; contentValues . put ( columnName , ( Float ) value ) ; } else if ( value instanceof Double ) { validateValue ( column , value , Double . class ) ; contentValues . put ( columnName , ( Double ) value ) ; } else { throw new GeoPackageException ( "Unsupported Number type: " + value . getClass ( ) . getSimpleName ( ) ) ; } } else if ( value instanceof String ) { validateValue ( column , value , String . class ) ; String stringValue = ( String ) value ; if ( column . getMax ( ) != null && stringValue . length ( ) > column . getMax ( ) ) { throw new GeoPackageException ( "String is larger than the column max. Size: " + stringValue . length ( ) + ", Max: " + column . getMax ( ) + ", Column: " + columnName ) ; } contentValues . put ( columnName , stringValue ) ; } else if ( value instanceof byte [ ] ) { validateValue ( column , value , byte [ ] . class ) ; byte [ ] byteValue = ( byte [ ] ) value ; if ( column . getMax ( ) != null && byteValue . length > column . getMax ( ) ) { throw new GeoPackageException ( "Byte array is larger than the column max. Size: " + byteValue . length + ", Max: " + column . getMax ( ) + ", Column: " + columnName ) ; } contentValues . put ( columnName , byteValue ) ; }
Map the column to the content values