| 1 | /** |
| 2 | * Licensed to jclouds, Inc. (jclouds) under one or more |
| 3 | * contributor license agreements. See the NOTICE file |
| 4 | * distributed with this work for additional information |
| 5 | * regarding copyright ownership. jclouds licenses this file |
| 6 | * to you under the Apache License, Version 2.0 (the |
| 7 | * "License"); you may not use this file except in compliance |
| 8 | * with the License. You may obtain a copy of the License at |
| 9 | * |
| 10 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | * |
| 12 | * Unless required by applicable law or agreed to in writing, |
| 13 | * software distributed under the License is distributed on an |
| 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 15 | * KIND, either express or implied. See the License for the |
| 16 | * specific language governing permissions and limitations |
| 17 | * under the License. |
| 18 | */ |
| 19 | package org.jclouds.gogrid.functions; |
| 20 | |
| 21 | import java.util.SortedSet; |
| 22 | |
| 23 | /** |
| 24 | * General format of GoGrid's response. |
| 25 | * |
| 26 | * This is the wrapper for most responses, and the actual result (or error) will |
| 27 | * be set to {@link #list}. Note that even the single returned item will be set |
| 28 | * to {@link #list} per GoGrid's design. |
| 29 | * |
| 30 | * This class is not intended to be used by customers directly, it is here to |
| 31 | * assist in deserialization. |
| 32 | * |
| 33 | * @author Oleksiy Yarmula |
| 34 | */ |
| 35 | class GenericResponseContainer<T> { |
| 36 | |
| 37 | private Summary summary; |
| 38 | private String status; |
| 39 | private String method; |
| 40 | private SortedSet<T> list; |
| 41 | |
| 42 | public Summary getSummary() { |
| 43 | return summary; |
| 44 | } |
| 45 | |
| 46 | public String getStatus() { |
| 47 | return status; |
| 48 | } |
| 49 | |
| 50 | public String getMethod() { |
| 51 | return method; |
| 52 | } |
| 53 | |
| 54 | public SortedSet<T> getList() { |
| 55 | return list; |
| 56 | } |
| 57 | |
| 58 | static class Summary { |
| 59 | private int total; |
| 60 | private int start; |
| 61 | private int numPages; |
| 62 | private int returned; |
| 63 | |
| 64 | public int getTotal() { |
| 65 | return total; |
| 66 | } |
| 67 | |
| 68 | public int getStart() { |
| 69 | return start; |
| 70 | } |
| 71 | |
| 72 | public int getNumPages() { |
| 73 | return numPages; |
| 74 | } |
| 75 | |
| 76 | public int getReturned() { |
| 77 | return returned; |
| 78 | } |
| 79 | } |
| 80 | |
| 81 | } |