FasterXML / FasterXML/jackson-annotations

'Bundled' @JsonView annotations should merge

Offen
#38 5 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Java
Sterne
1.1k
Forks
342
Ø Merge
8 Std. 53 Min.
Gemergte PRs (30 T.)
2

Beschreibung

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.

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.