com.vaadin.hilla.crud.
Class ListRepositoryService<T,ID,R extends org.springframework.data.repository.CrudRepository<T,ID> & org.springframework.data.jpa.repository.JpaSpecificationExecutor<T>>
All Implemented Interfaces:
CountService
, GetService<T,
, ListService<T>
Direct Known Subclasses:
A browser-callable service that delegates list operations to a JPA repository.
-
Constructor Summary
ConstructorsConstructorDescriptionListRepositoryService
(R repository) Creates the service using the given repository.
-
Method Summary
Modifier and TypeMethodDescriptionlong
Counts the number of entities that match the given filter.
boolean
Checks if an object with the given id exists.
Gets the object with the given id.
protected R
Accessor for the repository instance.
Lists objects of the given type using the paging, sorting and filtering options provided in the parameters.
protected org.springframework.data.jpa.domain.Specification<T>
Converts the given filter to a JPA specification.
-
Constructor Details
-
ListRepositoryService
public ListRepositoryService() -
ListRepositoryService
Creates the service using the given repository.
Parameters:
repository
- the JPA repository
-
-
Method Details
-
getRepository
Accessor for the repository instance.
Returns:
the repository instance
-
list
Description copied from interface:
ListService
Lists objects of the given type using the paging, sorting and filtering options provided in the parameters.
Specified by:
list
in interfaceListService<T>
Parameters:
pageable
- contains information about paging and sortingfilter
- the filter to apply ornull
to not filterReturns:
a list of objects or an empty list if no objects were found
-
get
Description copied from interface:
GetService
Gets the object with the given id.
Specified by:
get
in interfaceGetService<T,
ID> Parameters:
id
- the id of the objectReturns:
the object, or an empty optional if no object with the given id
-
exists
Description copied from interface:
GetService
Checks if an object with the given id exists.
Specified by:
exists
in interfaceGetService<T,
ID> Parameters:
id
- the id of the objectReturns:
true
if the object exists,false
otherwise -
count
Counts the number of entities that match the given filter.
Specified by:
count
in interfaceCountService
Parameters:
filter
- the filter, ornull
to use no filterReturns:
-
toSpec
Converts the given filter to a JPA specification.
Parameters:
filter
- the filter to convertReturns:
a JPA specification
-
resolveEntityClass
-