com.hazelcast.query

## Class SqlPredicate

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

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

      public class SqlPredicate
      extends Object
      implements IndexAwarePredicate, VisitablePredicate, IdentifiedDataSerializable

  This class contains methods related to conversion of sql query to predicate.
  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `SqlPredicate()`
    `SqlPredicate(String sql)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Predicate` | `accept(com.hazelcast.query.impl.predicates.Visitor visitor, com.hazelcast.query.impl.Indexes indexes)` Accept visitor.
    `boolean` | `apply(Map.Entry mapEntry)` Applies this predicate to the given map entry.
    `boolean` | `equals(Object o)`
    `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.
    `int` | `getFactoryId()` Returns DataSerializableFactory factory ID for this class.
    `int` | `getId()` Returns type identifier for this class.
    `Predicate` | `getPredicate()`
    `int` | `hashCode()`
    `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.
    `void` | `readData(ObjectDataInput in)` Reads fields from the input stream
    `String` | `toString()`
    `void` | `writeData(ObjectDataOutput out)` Writes object fields to output stream

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

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

- - ### Constructor Detail

    - #### SqlPredicate

          public SqlPredicate(String sql)

    - #### SqlPredicate

          public SqlPredicate()

  - ### Method Detail

    - #### 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.

    - #### 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.

    - #### 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.

    - #### 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`

    - #### equals

          public boolean equals(Object o)

      Overrides:
        `equals` in class `Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### accept

          public Predicate accept(com.hazelcast.query.impl.predicates.Visitor visitor,
                                  com.hazelcast.query.impl.Indexes indexes)

      Description copied from interface: `VisitablePredicate`
      Accept visitor. Predicate can either return it's own instance if no modification was done as a result of the visit. In the case there is a change needed then the predicate has to return changed copy of itself. Predicates has to be treated as immutable for optimization purposes.
      Specified by:
        `accept` in interface `VisitablePredicate`
      Parameters:
        `visitor` - visitor to accept
        `indexes` - indexes
      Returns:
        itself or its changed copy

    - #### getPredicate

          public Predicate getPredicate()

    - #### getFactoryId

          public int getFactoryId()

      Description copied from interface: `IdentifiedDataSerializable`
      Returns DataSerializableFactory factory ID for this class.
      Specified by:
        `getFactoryId` in interface `IdentifiedDataSerializable`
      Returns:
        factory ID

    - #### getId

          public int getId()

      Description copied from interface: `IdentifiedDataSerializable`
      Returns type identifier for this class. It should be unique per DataSerializableFactory.
      Specified by:
        `getId` in interface `IdentifiedDataSerializable`
      Returns:
        type ID

Copyright © 2019. All rights reserved.