public static FilterPredicate areEqual ( FilterableAttribute attribute , Object value ) { FilterPredicate pred = new FilterPredicate ( ) ; pred . attribute = attribute ; Class < ? > requiredType = attribute . getType ( ) ; if ( ! requiredType . isInstance ( value ) ) { throw new IllegalArgumentException ( "The value must be of the correct type for the FilterableAttribute." + " Expected: " + requiredType . getName ( ) + " but was " + value . getClass ( ) . getName ( ) ) ; } pred . values = Collections . singleton ( getString ( value ) ) ; return pred ; }
Create a predicate specifying that the value of the specified attribute must exactly match the supplied value . The value must also be the type specified by the FilterableAttribute