Package de.qytera.qtaf.http
Class HTTPJsonEntityRepository<T>
java.lang.Object
de.qytera.qtaf.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 Object.Entity class.protected StringURL Path. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedHTTPJsonEntityRepository(HTTPJsonDao dao, String path, Class<T> entityClass) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionbuildItemPath(int id) Build path where to look for single entities.buildItemPath(String id) Build path where to look for single entities.abstract StringbuildItemPath(T entity) Build path where to look for single entities.Create single entity.Find single entity by ID.findOne(int id) Find single entity by ID.Update single entity.
-
Field Details
-
dao
HTTP JSON DAO Object. -
path
URL Path. -
entityClass
Entity class.
-
-
Constructor Details
-
HTTPJsonEntityRepository
Constructor.- Parameters:
dao- DAOpath- the HTTP resource pathentityClass- the entity's class
-
-
Method Details
-
buildItemPath
Build path where to look for single entities.- Parameters:
id- Entity id- Returns:
- the path
-
buildItemPath
Build path where to look for single entities.- Parameters:
id- Entity id- Returns:
- the path
-
buildItemPath
Build path where to look for single entities.- Parameters:
entity- Entity object- Returns:
- the path
-
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
-