org.springframework.data.repository.query

## Interface QueryByExampleExecutor<T>

Type Parameters:
  `T` -

    public interface QueryByExampleExecutor<T>

Interface to allow execution of Query by Example `Example` instances.

Since:
  1.12
Author:
  Mark Paluch, Christoph Strobl

### Method Summary

All Methods Instance Methods Abstract Methods
`<S extends T> long` `count(Example<S> example)` Returns the number of instances matching the given `Example`.
`<S extends T> boolean` `exists(Example<S> example)` Checks whether the data store contains elements that match the given `Example`.
`<S extends T> Iterable<S>` `findAll(Example<S> example)` Returns all entities matching the given `Example`.
`<S extends T> Page<S>` `findAll(Example<S> example, Pageable pageable)` Returns a `Page` of entities matching the given `Example`.
`<S extends T> Iterable<S>` `findAll(Example<S> example, Sort sort)` Returns all entities matching the given `Example` applying the given `Sort`.
`<S extends T> Optional<S>` `findOne(Example<S> example)` Returns a single entity matching the given `Example` or null if none was found.

### Method Detail

#### findOne

    <S extends T> Optional<S> findOne(Example<S> example)

Returns a single entity matching the given `Example` or null if none was found.

Parameters:
  `example` - must not be null.
Returns:
  a single entity matching the given `Example` or `Optional.empty()` if none was found.
Throws:
  `IncorrectResultSizeDataAccessException` - if the Example yields more than one result.

#### findAll

    <S extends T> Iterable<S> findAll(Example<S> example)

Returns all entities matching the given `Example`. In case no match could be found an empty `Iterable` is returned.

Parameters:
  `example` - must not be null.
Returns:
  all entities matching the given `Example`.

#### findAll

    <S extends T> Iterable<S> findAll(Example<S> example,
                                      Sort sort)

Returns all entities matching the given `Example` applying the given `Sort`. In case no match could be found an empty `Iterable` is returned.

Parameters:
  `example` - must not be null.
  `sort` - the `Sort` specification to sort the results by, must not be null.
Returns:
  all entities matching the given `Example`.
Since:
  1.10

#### findAll

    <S extends T> Page<S> findAll(Example<S> example,
                                  Pageable pageable)

Returns a `Page` of entities matching the given `Example`. In case no match could be found, an empty `Page` is returned.

Parameters:
  `example` - must not be null.
  `pageable` - can be null.
Returns:
  a `Page` of entities matching the given `Example`.

#### count

    <S extends T> long count(Example<S> example)

Returns the number of instances matching the given `Example`.

Parameters:
  `example` - the `Example` to count instances for. Must not be null.
Returns:
  the number of instances matching the `Example`.

#### exists

    <S extends T> boolean exists(Example<S> example)

Checks whether the data store contains elements that match the given `Example`.

Parameters:
  `example` - the `Example` to use for the existence check. Must not be null.
Returns:
  true if the data store contains elements that match the given `Example`.