Class BaseCodeAndDescriptionService<T extends BaseCodeAndDescriptionEntity>
java.lang.Object
com.github.collinalpert.java2db.services.BaseService<T>
com.github.collinalpert.java2db.services.BaseCodeAndDescriptionService<T>
public class BaseCodeAndDescriptionService<T extends BaseCodeAndDescriptionEntity> extends BaseService<T>
Describes a service class for an entity which contains an id, a code and a description.
- Author:
- Collin Alpert
-
Field Summary
-
Constructor Summary
Constructors Constructor Description BaseCodeAndDescriptionService() -
Method Summary
Modifier and Type Method Description java.util.Optional<T>getByCode(java.lang.String code)Retrieves an entry from a table based on its unique code.EntityQuery<T>getByDescription(java.lang.String description)Retrieves entries from a table based on their description.Methods inherited from class com.github.collinalpert.java2db.services.BaseService
any, any, count, count, create, create, create, createPagination, createPagination, createPagination, createPagination, createQuery, createSingleQuery, delete, delete, delete, delete, delete, delete, getAll, getAll, getAll, getAll, getAll, getById, getFirst, getMultiple, getSingle, hasDuplicates, max, max, min, min, truncateTable, update, update, update, update, update, update
-
Constructor Details
-
BaseCodeAndDescriptionService
public BaseCodeAndDescriptionService()
-
-
Method Details
-
getByCode
Retrieves an entry from a table based on its unique code.- Parameters:
code- The code to get the entity by.- Returns:
- An entity matching this code. It is assumed that a code, just like the id, is unique in a table.
-
getByDescription
Retrieves entries from a table based on their description. This is an uncommon method to use but exists for completeness sakes.- Parameters:
description- The description to get the results by.- Returns:
- A list of entities matching a certain description.
-