net.sixpointsix.carpo.common.repository.CrudEntityRepository Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of carpo-common Show documentation
Show all versions of carpo-common Show documentation
Common until library for carpo
package net.sixpointsix.carpo.common.repository;
import net.sixpointsix.carpo.common.model.CarpoEntity;
import java.util.Optional;
/**
* Common entity repository that can be extended to offer common persistence methods
*
* @param Data type
* @author Andrew Tarry
* @since 0.0.1
*/
public interface CrudEntityRepository {
/**
* Create a new record of the entity
*
* @param entity to be saved
*/
void create(E entity);
/**
* Save the changes to entity
* @param entity to be saved
*/
void update(E entity);
/**
* Delete an entity
*
* @param entity to be deleted
*/
void delete(E entity);
/**
* Get an entity by an id
*
* @param id id to search for
* @return entity data
*/
Optional getById(String id);
}