protected static boolean compareLT ( Object l , Object r ) { if ( l == null || r == null ) { return false ; // null fails all lt/gt/lte/gte tests } else if ( ! ( l instanceof String || l instanceof Number ) ) { String msg = String . format ( "Value in document not a Number or String: %s" , l ) ; logger . log ( Level . WARNING , msg ) ; return false ; // Not sure how to compare values that are not numbers or strings } else if ( l instanceof String ) { if ( r instanceof Number ) { return false ; // INT < STRING } String lStr = ( String ) l ; String rStr = ( String ) r ; return lStr . compareTo ( rStr ) < 0 ; } else if ( r instanceof String ) { // At this point in the logic l can only be a number return true ; // INT < STRING } else { // At this point in the logic both l and r can only be numbers Number lNum = ( Number ) l ; Number rNum = ( Number ) r ; return lNum . doubleValue ( ) < rNum . doubleValue ( ) ; } }
4 . BLOB