public class ApiPart<T> extends Object implements RetrieveUpdateDeleteApi<T>, QueryAndCreateApi<T>, ParentApiPart
Modifier and Type | Field and Description |
---|---|
protected com.fasterxml.jackson.databind.JavaType |
listType |
protected com.fasterxml.jackson.databind.ObjectMapper |
mapper |
protected ParentApiPart |
parent |
protected com.fasterxml.jackson.databind.JavaType |
type |
Constructor and Description |
---|
ApiPart(Class<T> type,
ParentApiPart parent) |
ApiPart(Class<T> type,
ParentApiPart parent,
com.fasterxml.jackson.databind.ObjectMapper mapper) |
Modifier and Type | Method and Description |
---|---|
T |
create(T item)
Create a new item.
|
void |
delete()
Delete the specified object.
|
T |
findOrCreate(T item)
Find the specified item, or create it.
|
T |
get()
Retrieve a specific object.
|
List<T> |
getList()
Retreive a list of the specified object.
|
ParentApiPart |
getParent() |
SlickClient |
getSlickClient() |
javax.ws.rs.client.WebTarget |
getWebTarget() |
protected javax.ws.rs.client.WebTarget |
getWebTargetForRequest() |
protected <V> V |
makeRequest(String method,
com.fasterxml.jackson.databind.JavaType type,
V body) |
T |
update(T item)
Update an object.
|
protected ParentApiPart parent
protected com.fasterxml.jackson.databind.ObjectMapper mapper
protected com.fasterxml.jackson.databind.JavaType type
protected com.fasterxml.jackson.databind.JavaType listType
public ApiPart(Class<T> type, ParentApiPart parent, com.fasterxml.jackson.databind.ObjectMapper mapper)
public ApiPart(Class<T> type, ParentApiPart parent)
protected javax.ws.rs.client.WebTarget getWebTargetForRequest() throws SlickError
SlickError
protected <V> V makeRequest(String method, com.fasterxml.jackson.databind.JavaType type, V body) throws SlickError
SlickError
public javax.ws.rs.client.WebTarget getWebTarget() throws SlickError
getWebTarget
in interface ParentApiPart
SlickError
public ParentApiPart getParent()
getParent
in interface ParentApiPart
public SlickClient getSlickClient()
getSlickClient
in interface ParentApiPart
public T get() throws SlickError
RetrieveUpdateDeleteApi
get
in interface RetrieveUpdateDeleteApi<T>
SlickError
- on errors reported from the slick server.public T update(T item) throws SlickError
RetrieveUpdateDeleteApi
update
in interface RetrieveUpdateDeleteApi<T>
SlickError
- if the slick server returns an error.public void delete() throws SlickError
RetrieveUpdateDeleteApi
delete
in interface RetrieveUpdateDeleteApi<T>
SlickError
- if the slick server returns an errorpublic List<T> getList() throws SlickError
QueryAndCreateApi
getList
in interface QueryAndCreateApi<T>
SlickError
- if an invalid usage occurs or if the server returns an error.public T create(T item) throws SlickError
QueryAndCreateApi
create
in interface QueryAndCreateApi<T>
item
- The details of what to createSlickError
- if an invalid usage occurs or if the server returns an error.public T findOrCreate(T item) throws SlickError
QueryAndCreateApi
findOrCreate
in interface QueryAndCreateApi<T>
item
- The details of what to create (if needed)SlickError
- if an invalid usage occurs or if the server returns an error.Copyright © 2015. All rights reserved.