YamlSerializer.java 文件源码

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

项目:BlockBall 作者:
/**
 * DeSerializes the given dataSource to an array
 *
 * @param clazz      type of the object
 * @param dataSource dataSource like map or fileConfiguration
 * @param <T>        type of the object
 * @return deSerialized array
 * @throws InstantiationException exception
 * @throws IllegalAccessException exception
 */
public static <T> T[] deserializeArray(Class<T> clazz, Object dataSource) throws InstantiationException, IllegalAccessException {
    final Map<String, Object> data = getDataFromSource(dataSource);
    final T[] objects = (T[]) Array.newInstance(clazz, data.size());
    int i = 0;
    for (final String key : data.keySet()) {
        objects[i] = deserializeObject(clazz, ((MemorySection) data.get(key)).getValues(false));
        i++;
    }
    return objects;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号