FasterXML / FasterXML/jackson-annotations

'Bundled' @JsonView annotations should merge

Aperta
#38 5 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Java
Stelle
1.1k
Fork
342
Merge medio
8h 53m
PR unite (30g)
2

Descrizione

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.

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.