ExpressionUtils { public static String asSql( String expression ) { if ( expression == null ) { return null; } for ( String key : EL_SQL_MAP.keySet() ) { expression = expression.replaceAll( key, EL_SQL_MAP.get( key ) ); } return expression; }  static Object evaluate( String expression, Map<String, Object> vars ); static Double evaluateToDouble( String expression, Map<String, Object> vars ); static boolean isTrue( String expression, Map<String, Object> vars ); static boolean isBoolean( String expression, Map<String, Object> vars ); static boolean isValid( String expression, Map<String, Object> vars ); static boolean isNumeric( String value ); static String asSql( String expression ); static Object evaluate( String expression );  }
@Test public void testAsSql() { assertEquals( "2 > 1 and 3 < 4", ExpressionUtils.asSql( "2 > 1 && 3 < 4" ) ); assertEquals( "2 > 1 or 3 < 4", ExpressionUtils.asSql( "2 > 1 || 3 < 4" ) ); assertEquals( "'a' = 1", ExpressionUtils.asSql( "'a' == 1" ) ); assertEquals( "\"oZg33kd9taw\" = 'Female'", ExpressionUtils.asSql( "\"oZg33kd9taw\" == 'Female'" ) ); }