Interface Persistence<T>

Type Parameters:
T - the type of the model class to persist
All Known Implementing Classes:
DefaultPersistence

public interface Persistence<T>
This interface defines the methods for persistence operations on a given model class. The creation of rest api using annotation @REST is based on this interface to deal with persistence
  • Method Summary

    Modifier and Type
    Method
    Description
    delete(T t)
    Deletes an existing instance of the model class from the persistence layer.
    Returns a list with all instances of the model class currently persisted.
    Returns the instance of the model class identified by the given ID.
    Returns a limited list with instances of the model class currently persisted.
    save(T t)
    Saves a new instance of the model class to the persistence layer.
    update(T t)
    Updates an existing instance of the model class in the persistence layer.
  • Method Details

    • getAll

      List<T> getAll()
      Returns a list with all instances of the model class currently persisted.
      Returns:
      a list with all instances of the model class currently persisted
    • getLimit

      List<T> getLimit(Integer limit)
      Returns a limited list with instances of the model class currently persisted.
      Parameters:
      limit - the maximum number of instances to retrieve
      Returns:
      a limited list with instances of the model class currently persisted
    • getById

      T getById(Object id)
      Returns the instance of the model class identified by the given ID.
      Parameters:
      id - the ID of the instance to retrieve
      Returns:
      the instance of the model class identified by the given ID, or null if not found
    • save

      T save(T t)
      Saves a new instance of the model class to the persistence layer.
      Parameters:
      t - the instance of the model class to save
      Returns:
      the saved instance of the model class
    • update

      T update(T t)
      Updates an existing instance of the model class in the persistence layer.
      Parameters:
      t - the instance of the model class to update
      Returns:
      the updated instance of the model class
    • delete

      T delete(T t)
      Deletes an existing instance of the model class from the persistence layer.
      Parameters:
      t - the instance of the model class to delete
      Returns:
      the deleted instance of the model class