|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.univocity.parsers.remote.Paginator<E,P>
E - type of RemoteEntitySettings of a parser with support for pagination. A paginator is essentially
an entity specifically configured and used for the purpose of retrieving more content from a current
state (or page), if available.public abstract class Paginator<E extends RemoteEntitySettings,P extends PaginationContext>
An abstract class that allows EntityParserInterface implementations that work
with RemoteEntitySettings to access multiple pages of remote content that needs to parsed.
RemoteParserSettings,
PaginationContext,
NextInputHandler| Field Summary | |
|---|---|
static String |
CURRENT_PAGE
Reserved field name used by the paginator to store the current page matching entity |
static String |
CURRENT_PAGE_NUMBER
Reserved field name used by the paginator to store the current page number |
static String |
ENTITY_NAME
Reserved field name used by the paginator to store itself as an entity |
protected E |
entitySettings
|
static String |
NEXT_PAGE
Reserved field name used by the paginator to store the next page matching entity |
static String |
NEXT_PAGE_NUMBER
Reserved field name used by the paginator to store the next page number |
| Constructor Summary | |
|---|---|
protected |
Paginator(RemoteParserSettings parserSettings)
Creates a new Paginator |
| Method Summary | |
|---|---|
Set<String> |
getFieldNames()
Returns the name of all fields associated with the paginator. |
int |
getFollowCount()
Returns the number of pages this Paginator can go up to. |
NextInputHandler<P> |
getPaginationHandler()
Returns the NextInputHandler associated with thie Paginator. |
boolean |
isUrlTestingEnabled()
Indicates whether this paginator should test URLs pointing to the next page before actually retrieving it. |
protected abstract E |
newEntitySettings(RemoteParserSettings parserSettings)
Internally, the Paginator uses an instance of RemoteEntitySettings that should allow
the definition of fields specifically to control the available pagination elements found in the parsed content. |
void |
setFollowCount(int followCount)
Sets the number of pages this Paginator can go up to. |
void |
setPaginationHandler(NextInputHandler<P> paginationHandler)
Sets the NextInputHandler which is used to prepare the call to the next page when the parser runs. |
void |
setUrlTestingEnabled(boolean urlTestingEnabled)
Configures this paginator to test URLs pointing to the next page before actually retrieving it. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected final E extends RemoteEntitySettings entitySettings
public static final String ENTITY_NAME
public static final String CURRENT_PAGE
public static final String CURRENT_PAGE_NUMBER
public static final String NEXT_PAGE
public static final String NEXT_PAGE_NUMBER
| Constructor Detail |
|---|
protected Paginator(RemoteParserSettings parserSettings)
Paginator
parserSettings - the parser settings to use| Method Detail |
|---|
protected abstract E newEntitySettings(RemoteParserSettings parserSettings)
Paginator uses an instance of RemoteEntitySettings that should allow
the definition of fields specifically to control the available pagination elements found in the parsed content.
parserSettings - the parser settings to use in the new Entity settings
RemoteEntitySettings, used to configure all
pagination-related elements.public final void setFollowCount(int followCount)
Paginator can go up to.
Defaults to -1 (no limit)
followCount - the maximum number of pages that should be visited from a given starting point.public final int getFollowCount()
Paginator can go up to.
Defaults to 0 (no limit)
public final void setPaginationHandler(NextInputHandler<P> paginationHandler)
NextInputHandler which is used to prepare the call to the next page when the parser runs.
Users can provide their NextInputHandler to obtain information about the pagination process through a
PaginationContext, and if required, to manipulate the remote call used to fetch the next page.
paginationHandler - the NextInputHandler that will be associated with this Paginatorpublic NextInputHandler<P> getPaginationHandler()
NextInputHandler associated with thie Paginator.
The NextInputHandler is used to prepare the call to the next page when the parser runs.
Users can provide their NextInputHandler to obtain information about the pagination process through a
PaginationContext, and if required, to manipulate the remote call used to fetch the next page.
NextInputHandler associated with this Paginatorpublic final Set<String> getFieldNames()
Paginator fields
are populated is delegated to concrete implementations of this class.
LinkedHashSet of field names available from this Paginator.public boolean isUrlTestingEnabled()
RemoteContext.getNextPage() returns content that might be a relative or
absolute URL pointing to the next page.
URL testing consists of executing a HEAD HttpRequest call to the next page
URL. If the response code returned by the remote server is 200 (i.e. HttpURLConnection.HTTP_OK)
then the next page URL can be used, otherwise pagination will stop.
Defaults to false
public void setUrlTestingEnabled(boolean urlTestingEnabled)
RemoteContext.getNextPage() returns content that might be a relative or absolute URL
pointing to the next page.
URL testing consists of executing a HEAD HttpRequest call to the next page
URL. If the response code returned by the remote server is 200 (i.e. HttpURLConnection.HTTP_OK)
then the next page URL can be used, otherwise pagination will stop.
Defaults to false
urlTestingEnabled - flag indicating whether the paginator should test URLs formed to capture the next page
before actually attempting to fetch it.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||