|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.univocity.parsers.remote.RemoteFollower<S,T,R>
S - Type of entity stored in RemoteEntityList associated with the RemoteLinkFollower.T - The type of RemoteEntityList that contains the entities used to parse a linked page. A RemoteLinkFollower
can be thought of as a special type of RemoteEntityList that is used on linked pages.R - The type of settings that configures a RemoteParserpublic abstract class RemoteFollower<S extends RemoteEntitySettings,T extends RemoteEntityList<S>,R extends RemoteParserSettings>
An abstract class that allow parsers that use RemoteParserSettings and RemoteEntityList to access and
parse linked pages. Linked page locations are generated with link following fields based on the content of the page.
| Field Summary | |
|---|---|
protected T |
entityList
|
protected S |
entitySettings
|
protected NextInputHandler<RemoteContext> |
nextLinkHandler
|
protected RemoteFollower |
parentLinkFollower
|
protected R |
parserSettings
|
protected TreeMap<String,com.univocity.api.common.ValueGetter<?>> |
urlParameters
|
| Constructor Summary | |
|---|---|
protected |
RemoteFollower(S parentEntitySettings)
Creates a new LinkFollower Uses the parentEntitySettings as a basis for the LinkFollower settings |
| Method Summary | |
|---|---|
S |
addEntity(String entityName)
Adds a new entity to this remote follower if it doesn't exist and returns its configuration. |
RemoteFollower |
assigning(String parameterName,
Object parameterValue)
Assign the parameter in the Url with the name parameterName to the value parameterValue |
RemoteFollower |
assigning(String parameterName,
com.univocity.api.common.ValueGetter<?> valueGetter)
Assign the parameter in the Url with the name ParameterName to the value supplied by the ValueGetter |
com.univocity.api.net.UrlReaderProvider |
getBaseUrl()
Returns the URL the remote follower should work with. |
S |
getEntity(String entityName)
Returns an entity of this remote follower. |
T |
getEntityList()
Returns the list of entities available from this remote follower |
Nesting |
getNesting()
Returns the nesting strategy to apply to rows associated to a "parent" row, such as results parsed from a link accessed by a RemoteFollower. |
NextInputHandler<RemoteContext> |
getNextLinkHandler()
Gets the next link handler. |
R |
getParserSettings()
Returns the settings object associated with the remote follower. |
void |
ignoreFollowingErrors(boolean ignoreLinkFollowingErrors)
Configures the parser to ignore (or not) invalid, malformed or unavailable links when following urls to collect additional data associated to a current result. |
boolean |
isIgnoreFollowingErrors()
Returns a flag indicating whether the parser will ignore invalid, malformed or unavailable links when following urls to collect additional data associated to a current result. |
void |
setBaseUrl(com.univocity.api.net.UrlReaderProvider baseUrlReaderProvider)
Defines a base URL for the remote follower to run. |
void |
setNesting(Nesting nesting)
Configures the nesting strategy to apply to rows associated to a "parent" row, such as results parsed from a link accessed by a RemoteFollower. |
void |
setNextLinkHandler(NextInputHandler<RemoteContext> nextLinkHandler)
Sets the next link handler which will have the NextInputHandler.prepareNextCall(RemoteContext) method
called before the next remote page is fetched. |
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected T extends RemoteEntityList<S> entityList
protected R extends RemoteParserSettings parserSettings
protected S extends RemoteEntitySettings entitySettings
protected final RemoteFollower parentLinkFollower
protected NextInputHandler<RemoteContext> nextLinkHandler
protected TreeMap<String,com.univocity.api.common.ValueGetter<?>> urlParameters
| Constructor Detail |
|---|
protected RemoteFollower(S parentEntitySettings)
parentEntitySettings as a basis for the LinkFollower settings
parentEntitySettings - the parent entity settings used as a basis for LinkFollower settings| Method Detail |
|---|
public final T getEntityList()
public final S addEntity(String entityName)
entityName - name of the entity whose configuration that will be returned.
public final S getEntity(String entityName)
entityName - name of the entity whose configuration that will be returned.
public final R getParserSettings()
public final com.univocity.api.net.UrlReaderProvider getBaseUrl()
public final void setBaseUrl(com.univocity.api.net.UrlReaderProvider baseUrlReaderProvider)
baseUrlReaderProvider - the new baseUrl for processing links.
public RemoteFollower assigning(String parameterName,
Object parameterValue)
parameterName to the value parameterValue
parameterName - name of the parameterparameterValue - value the parameter should hold
RemoteFollower to allow for method chaining
public RemoteFollower assigning(String parameterName,
com.univocity.api.common.ValueGetter<?> valueGetter)
ParameterName to the value supplied by the ValueGetter
parameterName - name of the parameter in the Url to assign tovalueGetter - the ValueGetter that will provide the value to be used as the parameter
RemoteFollower to allow for method chainingpublic final void ignoreFollowingErrors(boolean ignoreLinkFollowingErrors)
false, the parser will throw an Exception when attempting to follow a link that is invalid,
malformed or unavailable. If true, the parser will simply ignore the error and proceed.
Defaults to true
ignoreLinkFollowingErrors - true if the parser will ignore errors when accessing linked page, false otherwise.public final boolean isIgnoreFollowingErrors()
true
true if the parser is set to ignore errors when accessing linked pagepublic final Nesting getNesting()
RemoteFollower.
Defaults to the parent entity's RemoteEntitySettings.getNesting() or if undefined,
the RemoteParserSettings.getNesting() setting.
public final void setNesting(Nesting nesting)
RemoteFollower.
Defaults to the parent entity's RemoteEntitySettings.getNesting() or if undefined,
the RemoteParserSettings.getNesting() setting.
nesting - the nesting strategy to use when processing results associated with a parent row.public String toString()
toString in class Objectpublic NextInputHandler<RemoteContext> getNextLinkHandler()
NextInputHandler.prepareNextCall(RemoteContext) method called before the
next remote page is fetched.
public void setNextLinkHandler(NextInputHandler<RemoteContext> nextLinkHandler)
NextInputHandler.prepareNextCall(RemoteContext) method
called before the next remote page is fetched.
For example this could be used to modify the HTTP request configuration.
nextLinkHandler - the new link handler.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||