@Test public void shouldBuildGroupedAndOr2() { ConditionalCriteria criteria = criteriaFor(Person.class).lbrace().withProperty(aaa()).eq("A").and() .withProperty(bbb()).eq("B").rbrace() .or() .lbrace().withProperty(ccc()).eq("C").and().withProperty( ddd()).eq("D").rbrace() .buildSingle(); assertEquals(ConditionalCriteria.Operator.Or, criteria.getOperator()); ConditionalCriteria leftAnd = (ConditionalCriteria) criteria.getFirstOperant(); assertEquals(ConditionalCriteria.Operator.And, leftAnd.getOperator()); ConditionalCriteria rightAnd = (ConditionalCriteria) criteria.getSecondOperant(); assertEquals(ConditionalCriteria.Operator.And, rightAnd.getOperator()); assertEquals(ConditionalCriteria.Operator.Equal, ((ConditionalCriteria) leftAnd.getFirstOperant()) .getOperator()); assertEquals(ConditionalCriteria.Operator.Equal, ((ConditionalCriteria) leftAnd.getSecondOperant()) .getOperator()); assertEquals("aaa", ((ConditionalCriteria) leftAnd.getFirstOperant()).getPropertyName()); assertEquals("bbb", ((ConditionalCriteria) leftAnd.getSecondOperant()).getPropertyName()); assertEquals(ConditionalCriteria.Operator.Equal, ((ConditionalCriteria) rightAnd.getFirstOperant()) .getOperator()); assertEquals(ConditionalCriteria.Operator.Equal, ((ConditionalCriteria) rightAnd.getSecondOperant()) .getOperator()); assertEquals("ccc", ((ConditionalCriteria) rightAnd.getFirstOperant()).getPropertyName()); assertEquals("ddd", ((ConditionalCriteria) rightAnd.getSecondOperant()).getPropertyName()); }
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);  }