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

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

The newest version!
package fr.whimtrip.ext.jwhtscrapper.service.holder;


import fr.whimtrip.ext.jwhtscrapper.intfr.HtmlAutoScrapper;
import fr.whimtrip.ext.jwhtscrapper.intfr.LinksFollower;
import org.jetbrains.annotations.NotNull;

import java.lang.reflect.Field;
import java.util.ArrayList;

/**
 * 

Part of project jwht-scrapper

*

Created on 28/07/18

* *

* Inner holder class used by {@link LinksFollower} to prepare links * to scrap and return them to {@link HtmlAutoScrapper}. It will hold * the necessary context for a list of links to be followed and scrapped * and assigned to a single List field. *

* *

* This class therefore extends {@link ArrayList} with {@link LinkListScrappingContext} * typed List. It further contains the {@link #getFieldToBeSet()} and {@link #getParentObject()} * so that they can be retrieved from this instance and not from any underlying * {@link LinkListScrappingContext} which would lead to potential pattern flaws. *

* * @param

the parent POJO type. * @param the child POJO type which is either the type of the field to set * or, if an instance of this scrapping context is wrapped around a * {@link LinkListScrappingContext}, the type of the List field to * populate. * @author Louis-wht * @since 1.0.0 */ public class LinkListScrappingContext extends ArrayList> { @NotNull private final Field fieldToBeSet; @NotNull private final P parentObject; /** *

Default Constructor of this list class.

* @param fieldToBeSet see {@link #getFieldToBeSet()} * @param parentObject see {@link #getParentObject()} */ public LinkListScrappingContext(@NotNull final Field fieldToBeSet, @NotNull final P parentObject) { super(); this.fieldToBeSet = fieldToBeSet; this.parentObject = parentObject; } /** * @return the field to set the resulting value to. */ @NotNull public Field getFieldToBeSet() { return fieldToBeSet; } /** * @return the parent Object to assign {@link #getFieldToBeSet()} the resulting value of the current scrap. */ @NotNull public P getParentObject() { return parentObject; } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy