org.springframework.data.repository.query.parser

## Class AbstractQueryCreator<T,S>

- java.lang.Object
- - org.springframework.data.repository.query.parser.AbstractQueryCreator<T,S>

Type Parameters:
  `T` - the actual query type to be created
  `S` - the intermediate criteria type

    public abstract class AbstractQueryCreator<T,S>
    extends Object

Base class for query creators that create criteria based queries from a `PartTree`.

Author:
  Oliver Gierke, Mark Paluch, Christoph Strobl

### Constructor Summary

Constructors
Constructor and Description
`AbstractQueryCreator(PartTree tree)` Creates a new `AbstractQueryCreator` for the given `PartTree`.
`AbstractQueryCreator(PartTree tree, ParameterAccessor parameters)` Creates a new `AbstractQueryCreator` for the given `PartTree` and `ParametersParameterAccessor`.

### Method Summary

All Methods Instance Methods Abstract Methods Concrete Methods
`protected abstract S` `and(Part part, S base, Iterator<Object> iterator)` Creates a new criteria object from the given part and and-concatenates it to the given base criteria.
`protected abstract T` `complete(S criteria, Sort sort)` Actually creates the query object applying the given criteria object and `Sort` definition.
`protected abstract S` `create(Part part, Iterator<Object> iterator)` Creates a new atomic instance of the criteria object.
`T` `createQuery()` Creates the actual query object.
`T` `createQuery(Sort dynamicSort)` Creates the actual query object applying the given `Sort` parameter.
`protected abstract S` `or(S base, S criteria)` Or-concatenates the given base criteria to the given new criteria.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### AbstractQueryCreator

    public AbstractQueryCreator(PartTree tree)

Creates a new `AbstractQueryCreator` for the given `PartTree`. This will cause null be handed for the `Iterator` in the callback methods.

Parameters:
  `tree` - must not be null.
Since:
  2.0

#### AbstractQueryCreator

    public AbstractQueryCreator(PartTree tree,
                                ParameterAccessor parameters)

Creates a new `AbstractQueryCreator` for the given `PartTree` and `ParametersParameterAccessor`. The latter is used to hand actual parameter values into the callback methods as well as to apply dynamic sorting via a `Sort` parameter.

Parameters:
  `tree` - must not be null.
  `parameters` - must not be null.

### Method Detail

#### createQuery

    public T createQuery()

Creates the actual query object.

Returns:

#### createQuery

    public T createQuery(Sort dynamicSort)

Creates the actual query object applying the given `Sort` parameter. Use this method in case you haven't provided a `ParameterAccessor` in the first place but want to apply dynamic sorting nevertheless.

Parameters:
  `dynamicSort` - must not be null.
Returns:

#### create

    protected abstract S create(Part part,
                                Iterator<Object> iterator)

Creates a new atomic instance of the criteria object.

Parameters:
  `part` - must not be null.
  `iterator` - must not be null.
Returns:

#### and

    protected abstract S and(Part part,
                             S base,
                             Iterator<Object> iterator)

Creates a new criteria object from the given part and and-concatenates it to the given base criteria.

Parameters:
  `part` - must not be null.
  `base` - will never be null.
  `iterator` - must not be null.
Returns:

#### or

    protected abstract S or(S base,
                            S criteria)

Or-concatenates the given base criteria to the given new criteria.

Parameters:
  `base` - must not be null.
  `criteria` - must not be null.
Returns:

#### complete

    protected abstract T complete(@Nullable
                                  S criteria,
                                  Sort sort)

Actually creates the query object applying the given criteria object and `Sort` definition.

Parameters:
  `criteria` - can be null.
  `sort` - must not be null.
Returns: