示例#1
0
 public T create(T toCreate) throws HttpException {
   Response<T> response =
       DefaultRequestHandler.getInstance()
           .doRequest(HttpMethod.POST, getResourcesPath(), toCreate);
   I id = (I) (toCreate.getId() == null ? getCreatedId(response) : toCreate.getId());
   return get(id);
 }
示例#2
0
 public T update(T toUpdate) throws HttpException {
   DefaultRequestHandler.getInstance()
       .doRequest(HttpMethod.PUT, getResourcePath((I) toUpdate.getId()), toUpdate);
   return toUpdate;
 }
示例#3
0
 public void delete(I id) throws HttpException {
   DefaultRequestHandler.getInstance().doRequest(HttpMethod.DELETE, getResourcePath(id));
 }
示例#4
0
 public T get(I id) throws HttpException, ParseToObjectException {
   Response<T> response =
       DefaultRequestHandler.getInstance().doRequest(HttpMethod.GET, getResourcePath(id));
   return response.getBodyAsObject(getObjectClass());
 }