FasterXML / FasterXML/jackson-annotations

'Bundled' @JsonView annotations should merge

未关闭
#38 5 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Java
星标
1.1k
派生
342
平均合并
8 小时 53 分钟
30 天内合并 PR
2

描述

I have created two annotation bundles:

```
...
@JsonView(view1.class)
@JacksonAnnotationsInside
...
public @interface bundle1 {
...
```

and

```
...
@JsonView(view2.class)
@JacksonAnnotationsInside
...
public @interface bundle2 {
...
```

Then I apply the annotations to properties, like this:

```
@bundle1
String prop1

@bundle2
int prop2

@bundle1
@bundle2
boolean prop3
```

I would like it if the @JsonView annotations be merged for prop3 (becoming the equivalent of @JsonView({view1.class, view2.class})). Right now it appears that one of the them overwrites the other one.

Alternatively, if there is another way of doing what I am trying, I would appreciate that. I know I could create a 3rd annotation named bundle1and2, but that is a bit ugly and I end up with duplicate code. I know I can also remove the @JsonView from the bundles and separate it out and use @JsonView({view1.class, view2.class}), but I don't want to do that either as I would prefer the views to be encapsulated in the bundles.

贡献指南

这个仓库没有索引到贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。