I have a rest service that returns the object of a class that contains the following structure as a response:
public class LocalizacaoLinhaWrapper implements
Serializable {
...
private List<LocalizacaoLinha> linhasFavoritas;
private List<LocalizacaoLinha> linhasNaoFavoritas;
public boolean isEmpty() {
return linhasNaoFavoritas.isEmpty() && linhasNaoFavoritas.isEmpty();
}
//Getters e setters
}
I use the following command to return the response:
LocalizacaoLinhaWrapperDTO wrapper = service.minhaConsulta()//realizo a consulta
Response.status(Status.OK).entity(localizacaoWrapper).build()
When I make the request to this service everything is serialized correctly, however I have an attacker called empty
in my json , which was generated due to the existence of the LocalizacaoLinhaWrapper.isEmpty()
method.
Is it possible to set this method to be neglected at the time of serialization? If yes, how to do it?