com.geccocrawler.gecco.spider.render.RequestFieldRender Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of gecco Show documentation
Show all versions of gecco Show documentation
Easy to use lightweight web crawler
package com.geccocrawler.gecco.spider.render;
import java.lang.reflect.Field;
import java.util.Set;
import net.sf.cglib.beans.BeanMap;
import org.reflections.ReflectionUtils;
import com.geccocrawler.gecco.annotation.Request;
import com.geccocrawler.gecco.request.HttpRequest;
import com.geccocrawler.gecco.response.HttpResponse;
import com.geccocrawler.gecco.spider.SpiderBean;
public class RequestFieldRender implements FieldRender {
@Override
@SuppressWarnings({"unchecked" })
public void render(HttpRequest request, HttpResponse response, BeanMap beanMap, SpiderBean bean) {
Set requestFields = ReflectionUtils.getAllFields(bean.getClass(), ReflectionUtils.withAnnotation(Request.class));
for(Field field : requestFields) {
beanMap.put(field.getName(), request);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy