Creating type-safe comparators and hamcrest matchers using the generated QueryDSL metamodel
Java
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
src
.gitignore
README
pom.xml

README

QCar $ = QCar.car;

Matcher

Car car = new Car().setHorsePower(123);
assertThat(car, hasValue($.horsePower, equalTo(123)));

Comparator

Car car = new Car().setHorsePower(50);
Car betterCar = new Car().setHorsePower(150);
assertEquals(-1, pathComparator($.horsePower).compare(car, betterCar));

Future ideas:
 - Sort definition: new MutableSortDefinition($.horsePower, true, true)
 - Bean wrapper: getPropertyDescriptor($.horsePower)
 - Sort builder: asc($.horsePower, $.model) -> Sort (Spring Data JPA)