Interface QueryService<T,K>
- Type Parameters:
T- the type of the entity to be queriedK- the type of the entity's identifying key
- All Known Subinterfaces:
CrudService<T,K>
public interface QueryService<T,K>
Specifies the contract of a generic service that handles querying operations on entities.
- Author:
- mlopez
-
Method Summary
Modifier and TypeMethodDescriptionlongCount the number of entities that match a certain query specification.Apply filtering to entities in the system based on a certain query specification.filterWithSingleResult(QuerySpec filter) Apply filtering to entities in the system based on a certain query specification and retrieve a single result.findAll()Find all entities.Find an entity by its identifying key.
-
Method Details
-
findById
Find an entity by its identifying key.- Parameters:
id- the entity's identifying key- Returns:
- an
Optionalinstance containing the entity if it exists; otherwise empty
-
findAll
Find all entities.- Returns:
- a
Listcontaining all entities in the system
-
filter
Apply filtering to entities in the system based on a certain query specification.- Parameters:
filter- the query specification used for filtering- Returns:
- a
Listcontaining all entities matching the query specification
-
count
Count the number of entities that match a certain query specification.- Parameters:
filter- the query specification used for filtering- Returns:
- the number of entities that match the query specification
-
filterWithSingleResult
Apply filtering to entities in the system based on a certain query specification and retrieve a single result.- Parameters:
filter- the query specification used for filtering- Returns:
- an
Optionalinstance containing a single entity matching the query specification if it exists; otherwise empty
-