public static Predicate anyBitsSet ( final String expr , final long bits ) { return new Predicate ( ) { private String param ; public void init ( AbstractSqlCreator creator ) { param = creator . allocateParameter ( ) ; creator . setParameter ( param , bits ) ; } public String toSql ( ) { return String . format ( "(%s & :%s) > 0" , expr , param ) ; } } ; }
Adds a clause that checks whether ANY set bits in a bitmask are present in a numeric expression .