Package com.restfb

Class Connection<T>

java.lang.Object
com.restfb.Connection<T>
Type Parameters:
T - The Facebook type
All Implemented Interfaces:
Iterable<List<T>>

public class Connection<T> extends Object implements Iterable<List<T>>
Author:
Mark Allen
  • Constructor Details

    • Connection

      public Connection(FacebookClient facebookClient, String json, Class<T> connectionType)
      Creates a connection with the given jsonObject.
      Parameters:
      facebookClient - The FacebookClient used to fetch additional pages and map data to JSON objects.
      json - Raw JSON which must include a data field that holds a JSON array and optionally a paging field that holds a JSON object with next/previous page URLs.
      connectionType - Connection type token.
      Throws:
      FacebookJsonMappingException - If the provided json is invalid.
      Since:
      1.6.7
  • Method Details

    • iterator

      Specified by:
      iterator in interface Iterable<T>
      Since:
      1.6.7
      See Also:
      Iterable.iterator()
    • fetchNextPage

      protected Connection<T> fetchNextPage()
      Fetches the next page of the connection. Designed to be used by Connection.Itr.
      Returns:
      The next page of the connection.
      Since:
      1.6.7
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object object)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • getData

      public List<T> getData()
      Data for this connection.
      Returns:
      Data for this connection.
    • getPreviousPageUrl

      This connection's "previous page of data" URL.
      Returns:
      This connection's "previous page of data" URL, or null if there is no previous page.
      Since:
      1.5.3
    • getNextPageUrl

      This connection's "next page of data" URL.
      Returns:
      This connection's "next page of data" URL, or null if there is no next page.
      Since:
      1.5.3
    • hasPrevious

      public boolean hasPrevious()
      Does this connection have a previous page of data?
      Returns:
      true if there is a previous page of data for this connection, false otherwise.
    • hasNext

      public boolean hasNext()
      Does this connection have a next page of data?
      Returns:
      true if there is a next page of data for this connection, false otherwise.
    • getTotalCount

      public Long getTotalCount()
      provides the total count of elements, if FB provides them (API ≥ v2.0)
      Returns:
      the total count of elements if present
      Since:
      1.6.16
    • getOrder

      public String getOrder()
      returns the order of the elements
      Returns:
      the order of the elements
    • getBeforeCursor

    • getAfterCursor