Package de.qytera.qtaf.core.net.http
Class HTTPJsonEntityRepository<T>
java.lang.Object
de.qytera.qtaf.core.net.http.HTTPJsonEntityRepository<T>
- Type Parameters:
T- Entity Type
Class that is responsible for loading entities from an HTTP server that returns JSON Responses (i.e. a REST API)
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected HTTPJsonDaoHTTP JSON DAO ObjectEntity classprotected StringURL Path -
Constructor Summary
ConstructorsConstructorDescriptionHTTPJsonEntityRepository(HTTPJsonDao dao, String path, Class<T> entityClass) Constructor -
Method Summary
Modifier and TypeMethodDescriptionbuildItemPath(int id) Build path where to look for single entitiesbuildItemPath(String id) Build path where to look for single entitiesabstract StringbuildItemPath(T entity) Build path where to look for single entitiesCreate single entityFind single entity by IDfindOne(int id) Find single entity by IDUpdate single entity
-
Field Details
-
dao
HTTP JSON DAO Object -
path
URL Path -
entityClass
Entity class
-
-
Constructor Details
-
HTTPJsonEntityRepository
Constructor- Parameters:
dao- DAO
-
-
Method Details
-
buildItemPath
Build path where to look for single entities- Parameters:
id- Entity id
-
buildItemPath
Build path where to look for single entities- Parameters:
id- Entity id
-
buildItemPath
Build path where to look for single entities- Parameters:
entity- Entity object
-
findOne
Find single entity by ID- Parameters:
id- Entity ID- Returns:
- Entity object
-
createOne
Create single entity- Parameters:
entity- Entity object- Returns:
- Entity object
-
updateOne
Update single entity- Parameters:
entity- Entity object- Returns:
- Entity object
-
deleteOne
Find single entity by ID- Parameters:
entity- Entity object- Returns:
- Entity object
-