Interface CrudService<T,W,K>

Type Parameters:
T - The complete entity class
W - The writable entity class, can be the same as T
K - The primary key class of the entity

public interface CrudService<T,W,K>
A generic CRUD service interface for any writable entity.
  • Method Summary

    Modifier and Type
    Method
    Description
    create(W entity)
    Persists a new entity.
    void
    delete(K key)
    Deletes the entity.
    get(K key)
    Get an entity by its unique key.
    list(Pageable page)
    Lists all entity.
    void
    update(W entity)
    Updates the entity.
  • Method Details

    • create

      K create(W entity)
      Persists a new entity.
      Parameters:
      entity - to create.
      Returns:
      The persisted entity.
    • delete

      void delete(K key)
      Deletes the entity.
      Parameters:
      key - The entity key to delete.
    • get

      @Nullable T get(K key)
      Get an entity by its unique key.
      Returns:
      the entity or null if not existing.
    • list

      PagingResponse<T> list(@Nullable Pageable page)
      Lists all entity.
      Parameters:
      page - to enable paging.
      Returns:
      The pagable list of entities.
    • update

      void update(W entity)
      Updates the entity.
      Parameters:
      entity - to update