org.apache.ignite.cache.query

## Class ScanQuery<K,V>

- java.lang.Object
- - org.apache.ignite.cache.query.Query<javax.cache.Cache.Entry<K,V>>
  - - org.apache.ignite.cache.query.ScanQuery<K,V>

All Implemented Interfaces:
  Serializable

    public final class ScanQuery<K,V>
    extends Query<javax.cache.Cache.Entry<K,V>>

Scan query over cache entries. Will accept all the entries if no predicate was set.

See Also:
  `IgniteCache.query(Query)`, Serialized Form

### Field Summary

### Fields inherited from class org.apache.ignite.cache.query.Query

`DFLT_PAGE_SIZE`

### Constructor Summary

Constructors
Constructor and Description
`ScanQuery()` Create scan query returning all entries.
`ScanQuery(IgniteBiPredicate<K,V> filter)` Create scan query with filter.
`ScanQuery(int part)` Creates partition scan query returning all entries for given partition.
`ScanQuery(Integer part, IgniteBiPredicate<K,V> filter)` Create scan query with filter.

### Method Summary

All Methods Instance Methods Concrete Methods
`IgniteBiPredicate<K,V>` `getFilter()` Gets filter.
`Integer` `getPartition()` Gets partition number over which this query should iterate.
`ScanQuery<K,V>` `setFilter(IgniteBiPredicate<K,V> filter)` Sets filter.
`ScanQuery<K,V>` `setLocal(boolean loc)` Sets whether this query should be executed on local node only.
`ScanQuery<K,V>` `setPageSize(int pageSize)` Sets optional page size, if `0`, then default is used.
`ScanQuery<K,V>` `setPartition(Integer part)` Sets partition number over which this query should iterate.
`String` `toString()`

### Methods inherited from class org.apache.ignite.cache.query.Query

`getPageSize, isLocal, prepare`

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

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

### Constructor Detail

#### ScanQuery

    public ScanQuery()

Create scan query returning all entries.

#### ScanQuery

    public ScanQuery(int part)

Creates partition scan query returning all entries for given partition.

Parameters:
  `part` - Partition.

#### ScanQuery

    public ScanQuery(@Nullable
                     IgniteBiPredicate<K,V> filter)

Create scan query with filter.

Parameters:
  `filter` - Filter. If `null` then all entries will be returned.

#### ScanQuery

    public ScanQuery(@Nullable
                     Integer part,
                     @Nullable
                     IgniteBiPredicate<K,V> filter)

Create scan query with filter.

Parameters:
  `part` - Partition.
  `filter` - Filter. If `null` then all entries will be returned.

### Method Detail

#### getFilter

    public IgniteBiPredicate<K,V> getFilter()

Gets filter.

Returns:
  Filter.

#### setFilter

    public ScanQuery<K,V> setFilter(@Nullable
                                    IgniteBiPredicate<K,V> filter)

Sets filter.

Parameters:
  `filter` - Filter. If `null` then all entries will be returned.
Returns:
  `this` for chaining.

#### setPartition

    public ScanQuery<K,V> setPartition(@Nullable
                                       Integer part)

Sets partition number over which this query should iterate. If `null`, query will iterate over all partitions in the cache. Must be in the range [0, N) where N is partition number in the cache.

Parameters:
  `part` - Partition number over which this query should iterate.
Returns:
  `this` for chaining.

#### getPartition

    @Nullable
    public Integer getPartition()

Gets partition number over which this query should iterate. Will return `null` if partition was not set. In this case query will iterate over all partitions in the cache.

Returns:
  Partition number or `null`.

#### setPageSize

    public ScanQuery<K,V> setPageSize(int pageSize)

Sets optional page size, if `0`, then default is used.

Overrides:
  `setPageSize` in class `Query<javax.cache.Cache.Entry<K,V>>`
Parameters:
  `pageSize` - Optional page size.
Returns:
  `this` for chaining.

#### setLocal

    public ScanQuery<K,V> setLocal(boolean loc)

Sets whether this query should be executed on local node only.

Overrides:
  `setLocal` in class `Query<javax.cache.Cache.Entry<K,V>>`
Parameters:
  `loc` - Local flag.
Returns:
  `this` for chaining.

#### toString

    public String toString()

Overrides:
  `toString` in class `Query<javax.cache.Cache.Entry<K,V>>`

${current.year} Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Database and Caching Platform | : ver. 2.7.6
Release Date | : September 11 2019