io.clarify.api
Class ClarifyPaginatedModel

java.lang.Object
  extended by io.clarify.api.ClarifyModel
      extended by io.clarify.api.ClarifyPaginatedModel
Direct Known Subclasses:
BundleList, BundleSearchResults, BundleTrackList

public class ClarifyPaginatedModel
extends ClarifyModel

Base class for handling pagination within the Clarify Java SDK. Since the nextPage() method should be typed to the specific return class, no abstract method is provided for nextPage(). Instead, subclasses should provide the appropriate nextPage() implementation that returns the corresponding class type expected.


Field Summary
 
Fields inherited from class io.clarify.api.ClarifyModel
client, response
 
Constructor Summary
ClarifyPaginatedModel(ClarifyClient client, ClarifyResponse response)
           
 
Method Summary
 us.monoid.json.JSONArray getLinkItems()
          Returns items within the _links element of the JSON response.
 us.monoid.json.JSONObject getLinks()
          Returns a us.monoid.json.JSONObject for the _links element of the JSON response, allowing further exploration by the caller
 boolean hasNextPage()
          Determine if there is another page available, or if the returned response represents the last page
protected  us.monoid.json.JSONObject nextLink()
           
 
Methods inherited from class io.clarify.api.ClarifyModel
getClarifyClient, getClarifyResponse, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ClarifyPaginatedModel

public ClarifyPaginatedModel(ClarifyClient client,
                             ClarifyResponse response)
Method Detail

getLinks

public us.monoid.json.JSONObject getLinks()
Returns a us.monoid.json.JSONObject for the _links element of the JSON response, allowing further exploration by the caller

Returns:
a us.monoid.json.JSONObject for the _links element of the JSON response

getLinkItems

public us.monoid.json.JSONArray getLinkItems()
Returns items within the _links element of the JSON response. Each array element is a us.monoid.json.JSONObject providing access to the element

Returns:
a us.monoid.json.JSONArray containing all items under the _links element in the response

hasNextPage

public boolean hasNextPage()
Determine if there is another page available, or if the returned response represents the last page

Returns:
true if there is another page available for pagination

nextLink

protected us.monoid.json.JSONObject nextLink()
Returns:
the JSONObject for the next link under the _links, or null if not found


Copyright © 2015 Clarify Inc. All Rights Reserved.