PredicateUtils { public static <T> boolean isTrue(SerializablePredicate<T> predicate, String propertyId) { SerializablePredicate<T> extracted = extractPredicate(predicate, propertyId); if (extracted instanceof EqualsPredicate) { EqualsPredicate<T> equal = (EqualsPredicate<T>) extracted; return Boolean.TRUE.equals(equal.getValue()); } return false; } 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 testIsTrue() { EqualsPredicate<TestEntity> eq = new EqualsPredicate<>("prop1", Boolean.TRUE); assertTrue(PredicateUtils.isTrue(eq, "prop1")); eq = new EqualsPredicate<TestEntity>("prop1", Boolean.FALSE); assertFalse(PredicateUtils.isTrue(eq, "prop1")); EqualsPredicate<TestEntity> eq2 = new EqualsPredicate<>("prop1", "someString"); assertFalse(PredicateUtils.isTrue(eq2, "prop1")); GreaterThanPredicate<TestEntity> gt = new GreaterThanPredicate<>("prop1", Boolean.TRUE); assertFalse(PredicateUtils.isTrue(gt, "prop1")); }