io.github.ninobomba.commons.data.services.IReadService Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of t4m-commons Show documentation
Show all versions of t4m-commons Show documentation
Tools 4 Monkeys - Java Commons
The newest version!
package io.github.ninobomba.commons.data.services;
/**
* The interface IReadService is a generic interface for reading operations.
*
* @param the entity type
* @param the ID type
*/
public interface IReadService < T, ID > {
/**
* Finds and returns an optional entity that matches the given entity.
*
* @param entity the entity to find
* @return an optional entity that matches the given entity, or an empty optional if no match is found
*/
T findOne ( T entity );
/**
* Finds and returns an Optional entity based on the provided ID.
*
* @param id the ID of the entity to find
* @return an Optional entity that matches the given ID, or an empty Optional if no match is found
*/
T findById ( ID id );
}