public static class Category.Companion
Static Methods
Modifier and Type | Method and Description |
---|---|
Category |
create(DbHandler dbHandler,
java.lang.String name)
Creates a new Category in the database and returns the corresponding Category object.
If a category with the same name already exists, no new category will be created
and the existing one will be returned instead
|
Category |
fromResultSet(java.sql.ResultSet resultSet)
Generates a Category object from a ResultSet
|
Category |
get(DbHandler dbHandler,
int id)
Retrieves a Category from the database by its ID
|
Category |
get(DbHandler dbHandler,
java.lang.String nameOrId)
Retrieves a Category from the database by its name or ID
|
java.util.List<net.namibsun.papio.lib.db.models.Category> |
getAll(DbHandler dbHandler)
Retrieves a list of all Category objects in the database
|
public Category fromResultSet(java.sql.ResultSet resultSet)
Generates a Category object from a ResultSet
resultSet
- : The ResultSet to use to generate the Category objectpublic Category get(DbHandler dbHandler, int id)
Retrieves a Category from the database by its ID
dbHandler
- : The database handler to useid
- : The ID of the categorypublic Category get(DbHandler dbHandler, java.lang.String nameOrId)
Retrieves a Category from the database by its name or ID
dbHandler
- : The database handler to usenameOrId
- : The name or ID of the categorypublic java.util.List<net.namibsun.papio.lib.db.models.Category> getAll(DbHandler dbHandler)
Retrieves a list of all Category objects in the database
dbHandler
- : The database handler to usepublic Category create(DbHandler dbHandler, java.lang.String name)
Creates a new Category in the database and returns the corresponding Category object. If a category with the same name already exists, no new category will be created and the existing one will be returned instead
dbHandler
- : The database handler to use for database callsname
- : The name of the category