All Downloads are FREE. Search and download functionalities are using the official Maven repository.

fr.whimtrip.ext.jwhtscrapper.service.holder.ScrappingContext Maven / Gradle / Ivy

The newest version!
/*
 * This code is licensed to WhimTrip©. For any question, please contact the author of the file.
 */

/*
 * This code is licensed to WhimTrip©. For any question, please contact the author of the file.
 */


package fr.whimtrip.ext.jwhtscrapper.service.holder;

import fr.whimtrip.ext.jwhtscrapper.intfr.HtmlAutoScrapper;
import fr.whimtrip.ext.jwhtscrapper.intfr.ScrapperHelper;
import fr.whimtrip.ext.jwhtscrapper.intfr.AutomaticScrapperClient;
import fr.whimtrip.ext.jwhtscrapper.service.scoped.HttpWithProxyManagerClient;
import org.jetbrains.annotations.NotNull;

import java.util.List;

/**
 *
 *
 * 

Part of project jwht-scrapper

*

Created on 26/07/18

* *

* A Scrapping Context will hold required informations to * process to the {@link AutomaticScrapperClient}: *

* * @author Louis-wht * @since 1.0.0 * @param

P is the parent object which will be used each time to create the request and that * in the end will be modified. * @param M is the model on which the Html responses will be mapped * @param H is the Scrapper Helper instance that will be used to interpole some code in * the different steps of the scrapping task. */ public class ScrappingContext> { private final List

parentObjects; private final Class

parentClazz; private final Class modelClazz; private final H helper; private final RequestsScrappingContext requestsScrappingContext; @SuppressWarnings("unchecked") public ScrappingContext( @NotNull final List

parentObjects, @NotNull final Class

parentClazz, @NotNull final H helper ){ this.parentObjects = parentObjects; this.parentClazz = parentClazz; this.helper = helper; this.requestsScrappingContext = helper.init(); this.modelClazz = requestsScrappingContext.getModelClass(); } /** * @return the list of parentObjects of the scrapping * context. */ public List

getParentObjects() { return parentObjects; } /** * @return the parent Clazz. */ public Class

getParentClazz() { return parentClazz; } /** * @return the model clazz on which scrapping output will be mapped. */ public Class getModelClazz() { return modelClazz; } /** * @return the helper class that will handle all of the hooks and * object custom processing. */ public H getHelper() { return helper; } /** * @return the scrapping context of this request which holds * information that will be used by the {@link HtmlAutoScrapper} * and the {@link HttpWithProxyManagerClient}. */ public RequestsScrappingContext getRequestsScrappingContext() { return requestsScrappingContext; } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy