@Test public void shouldBuildSingleListOfConditions() { ConditionalCriteria criteriaS = criteriaFor(Person.class).withProperty(aaa()).eq(1234).and().withProperty(bbb()) .eq("zzz") .and() .withProperty(ccc()).eq("xxx").buildSingle(); assertEquals(ConditionalCriteria.Operator.And, criteriaS.getOperator()); @SuppressWarnings("unchecked") List<ConditionalCriteria> criteria=(List<ConditionalCriteria>) criteriaS.getFirstOperant(); ConditionalCriteria first=(ConditionalCriteria) criteria.get(0); ConditionalCriteria second=(ConditionalCriteria) criteria.get(1); ConditionalCriteria third=(ConditionalCriteria) criteria.get(2); assertEquals("aaa", first.property.getName()); assertEquals("bbb", second.property.getName()); assertEquals("ccc", third.property.getName()); }
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);  }