ArrayAdapter.java 文件源码

java
阅读 20 收藏 0 点赞 0 评论 0

项目:ConfigAPI 作者:
@Override
public Object read(String key, ConfigurationSection section) {
    List<?> list;

    if (section.isConfigurationSection(key)) {
        list = new ArrayList<>(section.getConfigurationSection(key).getValues(false).values());
    } else {
        list = section.getList(key);
    }

    Object array = Array.newInstance(type, list.size());

    for (int i = 0; i < list.size(); i++) {
        Object obj = list.get(i);
        ConfigurationSection dummySection = new MemoryConfiguration();

        dummySection.set("dummy", obj);
        Array.set(array, i, handler.adaptIn(dummySection, "dummy", obj.getClass()));
    }

    return array;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号