@Test public void shouldBuildGroupedNotAndOr() { ConditionalCriteria criteria = criteriaFor(Person.class).not().lbrace().withProperty(aaa()).eq("A").and() .withProperty(bbb()).eq("B").rbrace().or().withProperty(ccc()).eq("C").buildSingle(); assertEquals(ConditionalCriteria.Operator.Or, criteria.getOperator()); ConditionalCriteria left1 = (ConditionalCriteria) criteria.getFirstOperant(); assertEquals(ConditionalCriteria.Operator.Not, left1.getOperator()); ConditionalCriteria andCriteria = ((ConditionalCriteria) left1.getFirstOperant()); assertEquals(ConditionalCriteria.Operator.And, andCriteria.getOperator()); assertEquals("aaa", ((ConditionalCriteria) andCriteria.getFirstOperant()).getPropertyName()); assertEquals("bbb", ((ConditionalCriteria) andCriteria.getSecondOperant()).getPropertyName()); ConditionalCriteria right1 = (ConditionalCriteria) criteria.getSecondOperant(); assertEquals(ConditionalCriteria.Operator.Equal, right1.getOperator()); assertEquals("ccc", right1.getPropertyName()); assertEquals("C", right1.getFirstOperant()); }
public static <T> ConditionRoot<T> criteriaFor(Class<T> clazz) { return new ConditionalCriteriaBuilder<T>().new RootBuilderImpl(); }
ConditionalCriteriaBuilder { public static <T> ConditionRoot<T> criteriaFor(Class<T> clazz) { return new ConditionalCriteriaBuilder<T>().new RootBuilderImpl(); } }
ConditionalCriteriaBuilder { public static <T> ConditionRoot<T> criteriaFor(Class<T> clazz) { return new ConditionalCriteriaBuilder<T>().new RootBuilderImpl(); } private  ConditionalCriteriaBuilder(); }
ConditionalCriteriaBuilder { public static <T> ConditionRoot<T> criteriaFor(Class<T> clazz) { return new ConditionalCriteriaBuilder<T>().new RootBuilderImpl(); } private  ConditionalCriteriaBuilder(); static ConditionRoot<T> criteriaFor(Class<T> clazz); }
ConditionalCriteriaBuilder { public static <T> ConditionRoot<T> criteriaFor(Class<T> clazz) { return new ConditionalCriteriaBuilder<T>().new RootBuilderImpl(); } private  ConditionalCriteriaBuilder(); static ConditionRoot<T> criteriaFor(Class<T> clazz);  }