SpringletsDataJaxb.java 文件源码

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

项目:springlets 作者:
/**
 * Marshals each of the elements of the given {@link Iterable} using the given {@link XmlAdapter}.
 * 
 * @param source
 * @param adapter must not be {@literal null}.
 * @return
 * @throws Exception
 */
public static <T, S> List<S> marshal(Iterable<T> source, XmlAdapter<S, T> adapter) {

  Assert.notNull(adapter);

  if (source == null) {
    return Collections.emptyList();
  }

  List<S> result = new ArrayList<S>();

  for (T element : source) {
    try {
      result.add(adapter.marshal(element));
    } catch (Exception o_O) {
      throw new RuntimeException(o_O);
    }
  }

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


问题


面经


文章

微信
公众号

扫码关注公众号