映射Avro模型 [英] Mapping Avro Models
问题描述
我要映射Avro模型.给定Avro A的输入,我需要对其进行转换并返回Avro B.
I'm looking to map Avro models. Given an input of Avro A, I need to transform it and return back Avro B.
用例是我从服务接收Avro模型,对其进行转换以匹配我们的用例,然后将其还原为新的Avro模型.
The use case is that I receive Avro models from a service, transform them to match our use case, and restore them in a new Avro model.
目前,我正在考虑使用推土机,但是我想知道是否丢失了或有更好的选择.
Currently I'm looking into Dozer as a possibility, but I'm wondering if I'm missing something or if there are better options out there.
谷歌搜索的收益不高,或者我正在寻找完全错误的东西. Avro返回随机的平面零件,并且地图容易与Hash的Java变体混淆,因此寻找结果很有趣.对于上下文,我将map称为函数,该函数应用于元素列表以对其进行转换.
Googling about isn't yielding much, or I'm searching for the completely wrong things. Avro returns random plane parts, and map tends to get confused with the Java variant of a Hash, making it interesting to find results for. For context, I refer to map as a function that is applied to a list of elements to transform them.
推荐答案
推土机看起来很棒,您也可以看看Orika: https://code.google.com/p/orika/,它具有许多功能和出色的性能.
Dozer seems great, you can also take a look at Orika: https://code.google.com/p/orika/ which has many features and great performance.
You can check this blog post where there is a benchmark: http://blog.sokolenko.me/2013/05/dozer-vs-orika-vs-manual.html
Orika比Dozer快得多,并且非常接近手动"映射.
Orika is way faster than Dozer and quite close to "manual" mapping.
这篇关于映射Avro模型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!