Class AerisCustomResponse<T>
- java.lang.Object
-
- com.aerisweather.aeris.model.AerisBasics
-
- com.aerisweather.aeris.communication.AerisCustomResponse<T>
-
- Type Parameters:
T
- The wrapper object for response list
public abstract class AerisCustomResponse<T> extends AerisBasics
Custom response class to extend for easier parsing of the JSON string returned from a custom response.
-
-
Field Summary
-
Fields inherited from class com.aerisweather.aeris.model.AerisBasics
error, success
-
-
Constructor Summary
Constructors Constructor Description AerisCustomResponse(Class<T> clazz)
Constructor needed to pass the Class type for parsing the list parse of the response from JSON Strings to the desired class as a list.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
fromJSON(String json)
Construction from a JSON object.T
getFirstResponse()
Gets the first index in the list of the AerisDataJSON responses.List<T>
getListOfResponse()
Gets the list of data responsesint
getNumberOfResponses()
Returns the number of responses for this AerisResponse.T
getResponse(int index)
Gets the data for the given index.-
Methods inherited from class com.aerisweather.aeris.model.AerisBasics
getError, isSuccessful
-
-
-
-
Method Detail
-
getNumberOfResponses
public int getNumberOfResponses()
Returns the number of responses for this AerisResponse.- Returns:
- Number of responses
-
fromJSON
public void fromJSON(String json)
Description copied from class:AerisBasics
Construction from a JSON object. This constructor is needed to properly pull the JSON as the JSON response field can be an array or just a single object, so this helps fix that.- Overrides:
fromJSON
in classAerisBasics
- Parameters:
json
- Json object to use to construct the AerisResponse
-
getResponse
public T getResponse(int index)
Gets the data for the given index. Pass into aAerisFriendlyResponse
- Parameters:
index
- index to get the response at.- Returns:
- AerisData at that index.
-
getFirstResponse
public T getFirstResponse()
Gets the first index in the list of the AerisDataJSON responses.- Returns:
- data for the first response.
-
-