shade.com.alibaba.fastjson2.reader.FieldReaderListFuncImpl Maven / Gradle / Ivy
package com.alibaba.fastjson2.reader;
import com.alibaba.fastjson2.JSONReader;
import com.alibaba.fastjson2.util.TypeUtils;
import java.lang.reflect.Type;
import java.util.Collection;
import java.util.List;
import java.util.function.BiConsumer;
import java.util.function.Supplier;
class FieldReaderListFuncImpl
extends FieldReaderList {
final Supplier> listCreator;
final ObjectReader itemObjectReader;
public FieldReaderListFuncImpl(
Supplier> listCreator,
ObjectReader itemObjectReader,
BiConsumer> function,
Type itemType, String fieldName) {
super(fieldName, List.class, List.class, itemType, TypeUtils.getClass(itemType), 0, 0, null, null, null, null, null, null, function);
this.listCreator = listCreator;
this.itemObjectReader = itemObjectReader;
}
@Override
public Collection createList(JSONReader.Context context) {
return listCreator.get();
}
@Override
public void accept(T object, Object list) {
function.accept(object, list);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy