LessOrEqualPredicate extends ComparePredicate<T> { @Override public boolean test(T t) { if (t == null) { return false; } Object v = com.ocs.dynamo.utils.ClassUtils.getFieldValue(t, getProperty()); return compareValue(v) <= 0; } LessOrEqualPredicate(String property, Object value); @Override boolean test(T t);  }
@Test public void test() { LessOrEqualPredicate<TestEntity> p1 = new LessOrEqualPredicate<>("age", 20L); assertFalse(p1.test(null)); TestEntity t1 = new TestEntity(); t1.setAge(20L); assertTrue(p1.test(t1)); t1.setAge(24L); assertFalse(p1.test(t1)); t1.setAge(18L); assertTrue(p1.test(t1)); }