com.h3c.util.persistence.cassandra.query

## Class CountQuery<F,C>

- java.lang.Object
- - com.h3c.util.persistence.cassandra.query.CountQuery<F,C>

- Type Parameters:
    `F` - Type of filter object.
    `C` - Type of the context of the query. This varies with the implementation of the application and the database used.
  All Implemented Interfaces:
    ReadQuery<Long,C>

      public class CountQuery<F,C>
      extends Object
      implements ReadQuery<Long,C>

  Query for count number of entries with in a table or column family which matches the filter definition.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `CountQuery(F filter, Dao<?,?,?,F,?,C> dao)` Creates a Count query.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `Long` | `execute(C context)` Execute the count query.

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

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

- - ### Constructor Detail

    - #### CountQuery

          public CountQuery(F filter,
                    Dao<?,?,?,F,?,C> dao)

      Creates a Count query.
      Parameters:
        `filter` - filter to apply.
        `dao` - the DAO to carry out the operation.

  - ### Method Detail

    - #### execute

          public Long execute(C context)
                       throws Exception

      Execute the count query.
      Specified by:
        `execute` in interface `ReadQuery<Long,C>`
      Parameters:
        `context` - Context of the query.
      Returns:
        Return the number of entries matches the filter criteria.
      Throws:
        `NullPointerException` - In case of context is null.
        `Exception` - Throws Exception in case of any error in query execute.

Copyright © 2014. All Rights Reserved.