Package com.restfb

Class Connection<T>

    • Constructor Detail

      • 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 Detail

      • fetchNextPage

        protected Connection<TfetchNextPage()
        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
      • getData

        public List<TgetData()
        Data for this connection.
        Returns:
        Data for this connection.
      • getPreviousPageUrl

        public String 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
      • setPreviousPageUrl

        protected void setPreviousPageUrl​(String previousPageUrl)
        overrides the "previous page" URL with the given value
        Parameters:
        previousPageUrl -
      • getNextPageUrl

        public String 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
      • setNextPageUrl

        protected void setNextPageUrl​(String nextPageUrl)
        overrides the "next page" URL with the given value
        Parameters:
        nextPageUrl -
      • 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