如何创建AVRO模式以具有Java Avro Maven生成类的类似名称?
我有一个用例来创建具有两个字符串字段的AVRO模式,但是两个字段看起来都相似,
- firstName
- first_name
由于某些遗产原因,这两个字段是不同的字段。我现在面临的问题是,在生成Java类时,我会得到以下例外,
method setFirstName(java.lang.String) is already defined in class
这是因为Avro Maven插件正在尝试为每个变量创建两个相同的设置器方法。由于某些遗产原因,我无法在源端修复它。是否有任何选择在Avro Maven插件级别上处理这种情况?
参考代码,看起来只有当两个字段完全相同时,除了第一个字符以外的两个字段时,该代码似乎只有处理,但是在我的情况下,这种冲突策略并没有撤回我。
I have a use case to create Avro Schema with two string field but both the field would look similar,
- firstName
- first_name
These two are different field due to some legacy reason. The problem that I face now is that, on generating Java class I am getting the following exception,
method setFirstName(java.lang.String) is already defined in class
This is because the Avro maven plugin is trying to create two same setter method for each variable. For some legacy reason I can't fix it in the source end. Is there any option to handle this case in the Avro maven plugin level?
After referring to the code, it looks like the code handles only when two field are exact same except the first character, but in my case this conflict strategy is not recusing me.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不相信您想做的事情目前是AVRO 1.11.0,这是一个不错的功能,可以添加到Avro Maven插件(at 他们的问题跟踪器)。
我认为,生成的代码从未考虑到
snake_case
vorscomelcase
字段引起的碰撞,但是应该。I don't believe that what you want to do is currently possible as of Avro 1.11.0, and this is a nice feature to add to the Avro Maven plugin (at their issues tracker).
In my opinion, the generated code has never taken into account collisions caused by
snake_case
versuscamelCase
fields, but it should.