com.hazelcast.query

## Class PredicateBuilder

- java.lang.Object
- - com.hazelcast.query.PredicateBuilder

- All Implemented Interfaces:
    DataSerializable, IndexAwarePredicate, Predicate, Serializable

      public class PredicateBuilder
      extends Object
      implements IndexAwarePredicate, DataSerializable

  This class provides functionality to build predicate.
  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `PredicateBuilder()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `PredicateBuilder` | `and(Predicate predicate)`
    `boolean` | `apply(Map.Entry mapEntry)` Applies this predicate to the given map entry.
    `Set<com.hazelcast.query.impl.QueryableEntry>` | `filter(com.hazelcast.query.impl.QueryContext queryContext)` Produces a filtered entry set by utilizing the indexes available while executing the query in the given query context.
    `String` | `getAttribute()`
    `EntryObject` | `getEntryObject()`
    `boolean` | `isIndexed(com.hazelcast.query.impl.QueryContext queryContext)` Signals to the query engine that this predicate is able to utilize the indexes available while executing the query in the given query context.
    `PredicateBuilder` | `or(Predicate predicate)`
    `void` | `readData(ObjectDataInput in)` Reads fields from the input stream
    `void` | `setAttribute(String attribute)`
    `String` | `toString()`
    `void` | `writeData(ObjectDataOutput out)` Writes object fields to output stream

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

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

- - ### Constructor Detail

    - #### PredicateBuilder

          public PredicateBuilder()

  - ### Method Detail

    - #### getAttribute

          public String getAttribute()

    - #### setAttribute

          public void setAttribute(String attribute)

    - #### apply

          public boolean apply(Map.Entry mapEntry)

      Description copied from interface: `Predicate`
      Applies this predicate to the given map entry.

      Implementations must be thread-safe, since this method may be called by multiple threads concurrently.

      Specified by:
        `apply` in interface `Predicate`
      Parameters:
        `mapEntry` - the map entry to apply this predicate to.
      Returns:
        `true` if the given map entry matches this predicate, `false` otherwise.

    - #### getEntryObject

          public EntryObject getEntryObject()

    - #### and

          public PredicateBuilder and(Predicate predicate)

    - #### or

          public PredicateBuilder or(Predicate predicate)

    - #### filter

          public Set<com.hazelcast.query.impl.QueryableEntry> filter(com.hazelcast.query.impl.QueryContext queryContext)

      Description copied from interface: `IndexAwarePredicate`
      Produces a filtered entry set by utilizing the indexes available while executing the query in the given query context.

      The query engine assumes this method produces the result set faster than a simple evaluation of the predicate on every entry.

      Specified by:
        `filter` in interface `IndexAwarePredicate`
      Parameters:
        `queryContext` - the query context to access the indexes. The passed query context is valid only for a duration of a single call to the method.
      Returns:
        the produced filtered entry set.

    - #### isIndexed

          public boolean isIndexed(com.hazelcast.query.impl.QueryContext queryContext)

      Description copied from interface: `IndexAwarePredicate`
      Signals to the query engine that this predicate is able to utilize the indexes available while executing the query in the given query context.
      Specified by:
        `isIndexed` in interface `IndexAwarePredicate`
      Parameters:
        `queryContext` - the query context to consult for the available indexes.
      Returns:
        `true` if this predicate is able to use the indexes to speed up the processing, `false` otherwise.

    - #### writeData

          public void writeData(ObjectDataOutput out)
                         throws IOException

      Description copied from interface: `DataSerializable`
      Writes object fields to output stream
      Specified by:
        `writeData` in interface `DataSerializable`
      Parameters:
        `out` - output
      Throws:
        `IOException` - if an I/O error occurs. In particular, an `IOException` may be thrown if the output stream has been closed.

    - #### readData

          public void readData(ObjectDataInput in)
                        throws IOException

      Description copied from interface: `DataSerializable`
      Reads fields from the input stream
      Specified by:
        `readData` in interface `DataSerializable`
      Parameters:
        `in` - input
      Throws:
        `IOException` - if an I/O error occurs. In particular, an `IOException` may be thrown if the input stream has been closed.

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

Copyright © 2020. All rights reserved.