this is literally making my head explode because I can´t find a pretty way to solve this: I'm working with complex responses like this.
{
"etiquetaPago": "1001462713 ",
"codigoAdhesion": "01",
"vencimientos": null,
"empresa": {
"codigo": "911",
"descripcion": "Universidad Arg. John F. Kennedy",
"rubro": {
"codigo": "14",
"descripcion": "Instituciones Educativas"
},
"manejaBaseDeudas": false,
"manejaMultiplesConceptos": false,
"manejaIngresoReferencia": true,
"manejaIngresoImportes": false,
"habilitado": true,
"importesFijos": null,
"importesPosibles": null
},
"concepto": [
{
"codigoConcepto": "001",
"descripcionConcepto": "Cuota",
"tipoPago": "PAGO_IGUAL",
"manejaIngresoReferencia": true,
"textoIngresoReferencia": true,
"validaLongitudReferencia": true,
"longitudMinimaTextoReferencia": 2,
"longitudMaximaTextoReferencia": 2,
"manejaIngresoImportes": false,
"manejaRango": true,
"importeFijo": 100.0,
"importeMinimo": 100.0,
"importeMaximo": 100.0
}
]
}
And I have to parse it into a DTO class like this:
public class ConsultaPagosAgendaResponseDTO {
List<PagoAgendaDTO> pagosAgendas;
}
Which has inside:
public class PagoAgendaDTO {
private String etiquetaPago;
private String codigoAdhesion;
private EmpresaDTO empresa;
private List<VencimientoDTO> vencimientos;
private List<ConceptoDTO> conceptos;
}
public class EmpresaDTO {
private String codigo;
private String descripcion;
private RubroDTO rubro;
private boolean manejaBaseDeudas;
private boolean manejaMultiplesConceptos;
private boolean manejaIngresoReferencia;
private boolean manejaIngresoImportes;
private boolean habilitado;
}
And goes on..
The easy way would be making it by hand, iterating with foreach, but I would like to go with other type of approach, but don't know any, what would you recommend?
In this case DTO may be exactly as response, but they may differ too.
Thanks