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

us.codecraft.webmagic.model.PageMapper Maven / Gradle / Ivy

The newest version!
package us.codecraft.webmagic.model;

import us.codecraft.webmagic.Page;

import java.util.List;

/**
 * @author [email protected]
 * @since 0.5.2
 */
public class PageMapper {

    private Class clazz;

    private PageModelExtractor pageModelExtractor;

    public PageMapper(Class clazz) {
        this.clazz = clazz;
        this.pageModelExtractor = PageModelExtractor.create(clazz);
    }

    public T get(Page page) {
        return (T) pageModelExtractor.process(page);
    }

    public List getAll(Page page) {
        return (List) pageModelExtractor.process(page);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy