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)return the typed summary.int
hashCode()
boolean
hasNext()
Does this connection have a next page of data?boolean
Does this connection have a previous page of data?iterator()
void
replaceFacebookClient
(FacebookClient facebookClient) replace the current facebookclient with the new one.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
-
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
-
getTypedSummary
return the typed summary.For some connections, there is summary object that contains almost the same fields as the type that is used in the connection. For example ad insights fill the summary that way (if you use the right query parameter)
- Returns:
- the typed summary, may be null
-
replaceFacebookClient
replace the current facebookclient with the new one.- Parameters:
facebookClient
- the new FacebookClient
-