PredicateUtils { public static <T> boolean isPredicateValueSet(SerializablePredicate<T> predicate, Set<String> ignore) { boolean result = false; if (predicate instanceof CompositePredicate) { CompositePredicate<T> jf = (CompositePredicate<T>) predicate; for (SerializablePredicate<T> f : jf.getOperands()) { result |= isPredicateValueSet(f, ignore); } } else if (predicate instanceof BetweenPredicate) { BetweenPredicate<T> between = (BetweenPredicate<T>) predicate; if (ignore.contains(between.getProperty())) { return false; } return between.getValue() != null || between.getToValue() != null; } else if (predicate instanceof PropertyPredicate) { PropertyPredicate<T> eq = (PropertyPredicate<T>) predicate; if (ignore.contains(eq.getProperty())) { return false; } return eq.getValue() != null; } return result; } private  PredicateUtils(); @SafeVarargs static SerializablePredicate<T> extractPredicate(SerializablePredicate<T> predicate, String propertyId,
			Class<?>... typesToFind); @SafeVarargs static Object extractPredicateValue(SerializablePredicate<T> predicate, String propertyId,
			Class<?>... typesToFind); static boolean isTrue(SerializablePredicate<T> predicate, String propertyId); static boolean isPredicateValueSet(SerializablePredicate<T> predicate, Set<String> ignore);  }
@Test public void testIsPredicateValueSet() { assertEquals(false, PredicateUtils.isPredicateValueSet(null, new HashSet<>())); GreaterOrEqualPredicate<TestEntity> empty = new GreaterOrEqualPredicate<TestEntity>("test", null); assertFalse(PredicateUtils.isPredicateValueSet(empty, new HashSet<>())); GreaterOrEqualPredicate<TestEntity> eq = new GreaterOrEqualPredicate<TestEntity>("test", "bob"); assertTrue(PredicateUtils.isPredicateValueSet(eq, new HashSet<>())); assertFalse(PredicateUtils.isPredicateValueSet(eq, Set.of("test"))); assertTrue(PredicateUtils.isPredicateValueSet(new AndPredicate<TestEntity>(eq, empty), new HashSet<>())); assertFalse(PredicateUtils.isPredicateValueSet(new SimpleStringPredicate<>("test", null, true, true), new HashSet<>())); assertTrue(PredicateUtils.isPredicateValueSet(new SimpleStringPredicate<TestEntity>("test", "abc", true, true), new HashSet<>())); assertFalse(PredicateUtils.isPredicateValueSet(new LikePredicate<>("test", null, true), new HashSet<>())); assertTrue(PredicateUtils.isPredicateValueSet(new LikePredicate<TestEntity>("test", "abc", true), new HashSet<>())); assertFalse(PredicateUtils.isPredicateValueSet(new BetweenPredicate<TestEntity>("test", null, null), new HashSet<>())); assertTrue(PredicateUtils.isPredicateValueSet(new BetweenPredicate<TestEntity>("test", "abc", null), new HashSet<>())); assertTrue(PredicateUtils.isPredicateValueSet(new BetweenPredicate<TestEntity>("test", null, "def"), new HashSet<>())); }