code: public int count(Class<?> clazz, DynamoDBScanExpression scanExpression, DynamoDBMapperConfig config) {
          config = mergeConfig(config);
  
          ScanRequest scanRequest = createScanRequestFromExpression(clazz, scanExpression, config);
          scanRequest.setCount(true);
  
          // Count scans can also be truncated for large datasets
          int count = 0;
          ScanResult scanResult = null;
          do {
              scanResult = db.scan(applyUserAgent(scanRequest));
              count += scanResult.getCount();
              scanRequest.setExclusiveStartKey(scanResult.getLastEvaluatedKey());
          } while (scanResult.getLastEvaluatedKey() != null);
  
          return count;
      }
docs: Evaluates the specified scan expression and returns the count of matching
  items, without returning any of the actual item data.
  <p>
  This operation will scan your entire table, and can therefore be very
  expensive. Use with caution.
  
  @param clazz
  The class mapped to a DynamoDB table.
  @param scanExpression
  The parameters for running the scan.
  @param config
  The configuration to use for this scan, which overrides the
  default provided at object construction.
  @return The count of matching items, without returning any of the actual
  item data.