interface ScaffoldService<T, ID extends Serializable>
Scaffold service interface providing CRUD operations for domain entities.
This interface defines the complete contract for scaffold services. It is completely datastore-agnostic and can be implemented for any persistence backend: GORM (Hibernate, MongoDB, Neo4j), JPA, JDBC, REST clients, or custom implementations.
readOnly flag to throw exceptions on mutations// Default GORM implementation
@Scaffold(Car)
class CarService {
// AST transformation generates implementation automatically
// Read-only service (save/delete are no-ops)
@Scaffold(domain = Report, readOnly = true)
class ReportService {}
} T - The entity/domain typeID - The identifier type (Long, String, UUID, composite keys, etc.)| Type Params | Return Type | Name and description |
|---|---|---|
|
abstract java.lang.Long |
count(java.util.Map args)Count the total number of entities matching the given criteria. |
|
abstract void |
delete(ID id)Delete an entity by its identifier. |
|
abstract T |
get(ID id)Retrieve a single entity by its identifier. |
|
abstract java.util.List<T> |
list(java.util.Map args)List entities with optional pagination, sorting, and filtering. |
|
abstract T |
save(T instance)Save (create or update) an entity. |
Count the total number of entities matching the given criteria.
args - Map containing filtering criteriaDelete an entity by its identifier.
Implementations should handle the case where the entity doesn't exist gracefully (either silently succeed or throw a specific exception).
In readOnly mode, this operation is silently ignored (no-op).
id - The identifier of the entity to deleteRetrieve a single entity by its identifier.
id - The entity identifierList entities with optional pagination, sorting, and filtering.
The args map typically contains:
max - Maximum number of results to returnoffset - Starting offset for paginationsort - Field name to sort byorder - Sort order ('asc' or 'desc')args - Map containing query parameters for pagination, sorting, and filteringSave (create or update) an entity.
Implementations should:
instance - The entity instance to save