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

us.codecraft.webmagic.ResultItems Maven / Gradle / Ivy

The newest version!
package us.codecraft.webmagic;

import java.util.LinkedHashMap;
import java.util.Map;

/**
 * Object contains extract results.
* It is contained in Page and will be processed in pipeline. * * @author [email protected]
* @since 0.1.0 * @see Page * @see us.codecraft.webmagic.pipeline.Pipeline */ public class ResultItems { private Map fields = new LinkedHashMap(); private Request request; private boolean skip; @SuppressWarnings("unchecked") public T get(String key) { Object o = fields.get(key); if (o == null) { return null; } return (T) fields.get(key); } public Map getAll() { return fields; } public ResultItems put(String key, T value) { fields.put(key, value); return this; } public Request getRequest() { return request; } public ResultItems setRequest(Request request) { this.request = request; return this; } /** * Whether to skip the result.
* Result which is skipped will not be processed by Pipeline. * * @return whether to skip the result */ public boolean isSkip() { return skip; } /** * Set whether to skip the result.
* Result which is skipped will not be processed by Pipeline. * * @param skip whether to skip the result * @return this */ public ResultItems setSkip(boolean skip) { this.skip = skip; return this; } @Override public String toString() { return "ResultItems{" + "fields=" + fields + ", request=" + request + ", skip=" + skip + '}'; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy