Skip to content

Commit

Permalink
Revert "Add count()"
Browse files Browse the repository at this point in the history
This reverts commit c16124f.
  • Loading branch information
Artur- committed Jan 13, 2025
1 parent c16124f commit ce450df
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 17 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.vaadin.flow.spring.data;

import org.jspecify.annotations.NonNull;
import org.jspecify.annotations.Nullable;

import com.vaadin.flow.spring.data.filter.Filter;
Expand All @@ -10,22 +9,14 @@
*/
public interface CountService {

/**
* Counts the number of items.
*
* @return
* the number of items in the service
*/
public long count();

/**
* Counts the number of items that match the given filter.
*
* @param filter
* the filter, never {@code null}
* the filter, or {@code null} to use no filter
* @return
* the number of items in the service that match the filter
*/
public long count(Filter filter);
public long count(@Nullable Filter filter);

}
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,15 @@ public boolean exists(ID id) {
return getRepository().existsById(id);
}

/**
* Counts the number of entities that match the given filter.
*
* @param filter
* the filter, or {@code null} to use no filter
* @return
*/
@Override
public long count() {
return getRepository().count();
}

@Override
public long count(Filter filter) {
public long count(@Nullable Filter filter) {
return getRepository().count(toSpec(filter));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import org.springframework.stereotype.Service;

import com.vaadin.flow.spring.data.jpa.CrudRepositoryService;

@Service
public class TestCrudRepositoryService
extends CrudRepositoryService<TestObject, Integer, TestRepository> {
Expand Down

0 comments on commit ce450df

Please sign in to comment.