Issue
I am using a DTO for both the insertion of an object and for the search that returns the data.
in particular, I was interested to understand if there is a way to hide some fields:
private List <aDTO> sos;
private List <aDTO> sosPast;
private List <aDTO> sosPresentFuture;
sos is used in writing to insert a list of objects. in the research, I need two separate elements, one that returns the past objects, one that returns the present and/or future objects.
so in insertion, I will have to show only
private List <aDTO> sos;
in the research, I will have to show only
private List <aDTO> sosPast;
private List <aDTO> sosPresentFuture;
(In research the problem was solved by
@Mapping(target = "sos", ignore = true)
in the mapper)
Now I need something to hide the two lists (sosPast and sosPresentFuture) in order to leave only the sos list.
Solution
I seem to have solved the problem by doing this:
@JsonProperty("sosPast")
@ReadOnlyProperty
@ApiModelProperty(hidden = true)
private List<aDTO> sosPast;
@JsonProperty("sosPresentFuture")
@ReadOnlyProperty
@ApiModelProperty(hidden = true)
private List <aDTO> sosPresentFuture;
Answered By - Paul Marcelin Bejan