Package com.guinetik.hexafun.hexa
Interface HexaRepo<T>
- Type Parameters:
T- The entity type this repository manages
- All Known Implementing Classes:
InMemoryHexaRepo
public interface HexaRepo<T>
Generic repository interface for entity persistence operations.
Provides CRUD (Create, Read, Update, Delete) operations with Result wrappers.
-
Method Summary
Modifier and TypeMethodDescriptionclear()Removes all entities from the repository.count()Counts the total number of entities in the repository.deleteAllById(List<String> ids) Deletes multiple entities by their IDs in a batch operation.deleteById(String id) Deletes an entity by its unique identifier.findAll()Retrieves all entities from the repository.findAll(int offset, int limit) Retrieves a paginated list of entities.findBy(DirectoryStream.Filter<T> filter) Retrieves entities that match the given filter criteria.Finds an entity by its unique identifier.Saves a single entity to the repository.Saves multiple entities to the repository in a batch operation.Updates an existing entity identified by its ID.
-
Method Details
-
save
Saves a single entity to the repository.- Parameters:
entity- The entity to save- Returns:
- A Result containing the saved entity with any generated values
-
saveAll
Saves multiple entities to the repository in a batch operation.- Parameters:
entities- The list of entities to save- Returns:
- A Result containing the list of saved entities
-
findById
Finds an entity by its unique identifier.- Parameters:
id- The unique identifier of the entity- Returns:
- A Result containing the found entity or an error if not found
-
findAll
Retrieves all entities from the repository.- Returns:
- A Result containing a list of all entities
-
findBy
Retrieves entities that match the given filter criteria.- Parameters:
filter- The filter to apply- Returns:
- A Result containing a list of matching entities
-
findAll
Retrieves a paginated list of entities.- Parameters:
offset- The number of entities to skiplimit- The maximum number of entities to return- Returns:
- A Result containing a list of entities within the specified range
-
count
Counts the total number of entities in the repository.- Returns:
- A Result containing the count of entities
-
update
Updates an existing entity identified by its ID.- Parameters:
id- The ID of the entity to updateentity- The updated entity data- Returns:
- A Result containing the updated entity
-
deleteById
Deletes an entity by its unique identifier.- Parameters:
id- The unique identifier of the entity to delete- Returns:
- A Result containing a Boolean indicating success
-
deleteAllById
Deletes multiple entities by their IDs in a batch operation.- Parameters:
ids- The list of entity IDs to delete- Returns:
- A Result indicating the operation outcome
-
clear
Removes all entities from the repository.- Returns:
- A Result indicating the operation outcome
-