Example usage for org.springframework.data.querydsl QSort QSort

List of usage examples for org.springframework.data.querydsl QSort QSort

Introduction

In this page you can find the example usage for org.springframework.data.querydsl QSort QSort.

Prototype

@SuppressWarnings("deprecation")
public QSort(List<OrderSpecifier<?>> orderSpecifiers) 

Source Link

Document

Creates a new QSort instance with the given OrderSpecifier s.

Usage

From source file:example.springdata.mongodb.customer.CustomerRepositoryIntegrationTest.java

/**
 * Test case to show the usage of the Querydsl-specific {@link QSort} to define the sort order in a type-safe way.
 *///from  w  w w.  j a  v a 2  s.  c om
@Test
public void findCustomersUsingQuerydslSort() {

    QCustomer customer = QCustomer.customer;
    List<Customer> result = repository.findByLastname("Matthews", new QSort(customer.firstname.asc()));

    assertThat(result, hasSize(2));
    assertThat(result.get(0), is(dave));
    assertThat(result.get(1), is(oliver));
}