Package com.restfb
Class Connection<T>
java.lang.Object
com.restfb.Connection<T>
- Type Parameters:
T
- The Facebook type
Represents a Graph API Connection type.
- Author:
- Mark Allen
-
Nested Class Summary
Modifier and TypeClassDescriptionprotected static class
Iterator over connection pages. -
Constructor Summary
ConstructorDescriptionConnection(FacebookClient facebookClient, String json, Class<T> connectionType)
Creates a connection with the givenjsonObject
. -
Method Summary
Modifier and TypeMethodDescriptionboolean
protected Connection<T>
Fetches the next page of the connection.getData()
Data for this connection.This connection's "next page of data" URL.getOrder()
returns the order of the elementsThis connection's "previous page of data" URL.provides the total count of elements, if FB provides them (API ≥ v2.0)int
hashCode()
boolean
hasNext()
Does this connection have a next page of data?boolean
Does this connection have a previous page of data?iterator()
toString()
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
Connection
Creates a connection with the givenjsonObject
.- Parameters:
facebookClient
- TheFacebookClient
used to fetch additional pages and map data to JSON objects.json
- Raw JSON which must include adata
field that holds a JSON array and optionally apaging
field that holds a JSON object with next/previous page URLs.connectionType
- Connection type token.- Throws:
FacebookJsonMappingException
- If the providedjson
is invalid.- Since:
- 1.6.7
-
-
Method Details
-
iterator
- Specified by:
iterator
in interfaceIterable<T>
- Since:
- 1.6.7
- See Also:
Iterable.iterator()
-
fetchNextPage
Fetches the next page of the connection. Designed to be used byConnection.Itr
.- Returns:
- The next page of the connection.
- Since:
- 1.6.7
-
toString
-
equals
-
hashCode
-
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
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
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
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
returns the order of the elements- Returns:
- the order of the elements
-
getBeforeCursor
-
getAfterCursor
-