us.codecraft.webmagic.model.fields.MultipleField Maven / Gradle / Ivy
package us.codecraft.webmagic.model.fields;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.List;
import org.slf4j.Logger;
import lombok.Getter;
import us.codecraft.webmagic.model.FieldExtractor;
import us.codecraft.webmagic.model.formatter.ObjectFormatter;
public class MultipleField extends PageField {
@Getter
private List fieldNames;
public MultipleField(List fieldNames) {
this.fieldNames = fieldNames;
}
public boolean operation(Object o, FieldExtractor fieldExtractor, Logger logger) throws IllegalAccessException, InvocationTargetException {
if ((this.fieldNames == null || this.fieldNames.size() == 0) && fieldExtractor.isNotNull())
return false;
if (fieldExtractor.getObjectFormatter() != null) {
List