Interface WriterRepository<E,​ID>

  • Type Parameters:
    E - Concrete type of the entity to be managed by the repository.
    ID - Concrete type of the entity's id.
    All Known Subinterfaces:
    BasicRepository<E,​ID>

    public interface WriterRepository<E,​ID>
    Interface for a repository with writing operations.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      <S extends E>
      void
      delete​(S entity)
      Deletes the given entity.
      void deleteAll()
      Deletes all the entities in the repository.
      void deleteById​(ID id)
      Deletes the entity with the given id.
      <S extends E>
      S
      save​(S entity)
      Saves the given entity.
    • Method Detail

      • save

        <S extends E> S save​(S entity)
                      throws java.lang.IllegalArgumentException
        Saves the given entity. Use the returned entity instance for further operation.
        Type Parameters:
        S - Concrete type of the entity.
        Parameters:
        entity - The entity to be saved.
        Returns:
        The saved instance.
        Throws:
        java.lang.IllegalArgumentException - If the given entity is null.
      • delete

        <S extends E> void delete​(S entity)
                           throws java.lang.IllegalArgumentException
        Deletes the given entity.
        Type Parameters:
        S - Concrete type of the entity.
        Parameters:
        entity - The entity to be deleted.
        Throws:
        java.lang.IllegalArgumentException - If the given entity is null.
      • deleteById

        void deleteById​(ID id)
                 throws java.lang.IllegalArgumentException
        Deletes the entity with the given id.
        Parameters:
        id - The id of the entity to be deleted.
        Throws:
        java.lang.IllegalArgumentException - If the given id is null.
      • deleteAll

        void deleteAll()
        Deletes all the entities in the repository.