DefaultQueryByExampleExecutor implements DataStoreAware, RepositoryConfigurationAware, RepositoryMetadataAware,
                   RepositoryFactoryConfigurationAware { public long count(Example example) { return retrieveAll(example).size(); } DefaultQueryByExampleExecutor(); Object findOne(Example example); Iterable findAll(Example example); Iterable findAll(Example example, Sort sort); Page findAll(Example example, Pageable pageable); long count(Example example); boolean exists(Example example); @Override void setDataStore(DataStore dataStore); @Override void setRepositoryConfiguration(RepositoryConfiguration repositoryConfiguration); @Override void setRepositoryMetadata(RepositoryMetadata repositoryMetadata); @Override void setRepositoryFactoryConfiguration(RepositoryFactoryConfiguration configuration);  }
@Test public void testCount() { final Person probe = new Person().setAddress(new Address().setState(new State().setName("ehe"))); final ExampleMatcher matching = ExampleMatcher.matching().withMatcher("address.state.name", ExampleMatcher.GenericPropertyMatchers .contains()).withIgnoreCase(); final Example<Person> example = Example.of(probe, matching); final long count = executor.count(example); assertThat(count, is(2L)); }