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

com.geccocrawler.gecco.spider.render.RequestFieldRender Maven / Gradle / Ivy

There is a newer version: 1.3.21
Show newest version
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