private static String mapToCQLString ( Map < String , Object > valueMap ) { StringBuffer buffer = new StringBuffer ( ) ; buffer . append ( "{" ) ; boolean bFirst = true ; for ( String name : valueMap . keySet ( ) ) { if ( bFirst ) { bFirst = false ; } else { buffer . append ( "," ) ; } buffer . append ( "'" ) ; buffer . append ( name ) ; buffer . append ( "':" ) ; Object value = valueMap . get ( name ) ; if ( value instanceof String ) { buffer . append ( "'" ) ; buffer . append ( value . toString ( ) ) ; buffer . append ( "'" ) ; } else { buffer . append ( value . toString ( ) ) ; } } buffer . append ( "}" ) ; return buffer . toString ( ) ; }
Values must be quoted if they aren t literals .