How to cast in Java?
This model is working, look at the figure!
You may notice that you are concatenating two string variables as you can see in the figure below;
My problem now is to be able to concatenate an Integer variable with a string variable, because eclipse does not allow, as you can see below;
I would have to do a cast , but I'm having difficulty to do for lack of experience, I need help in this regard!
This is the Code;
/*lista de NaoConformidade*/
@Autorizacao(values = { AutorizacaoSistema.M_ADM })
public List<TipoInconsistenciaEntity> getListNaoConformidade() {
AbstractCriteriaSearch<TipoInconsistenciaEntity> filtro =
new AbstractCriteriaSearch<TipoInconsistenciaEntity>(new TipoInconsistenciaEntity());
filtro.addOrder("codigo", ASC);
List<TipoInconsistenciaEntity> lista = tipoInconsistenciaService.listarEntidades(filtro);
List<TipoInconsistenciaEntity> listaRetorno = new ArrayList<TipoInconsistenciaEntity>();
for (TipoInconsistenciaEntity pj : lista) {
if(pj.getCodigo() > 5000) {
TipoInconsistenciaEntity p = new TipoInconsistenciaEntity();
p.setDescricao(pj.getDescricao());
p.setCodigo(pj.getCodigo() + " - ["+ pj.getDescricao() + "]");
listaRetorno.add(p);
}
}
return listaRetorno;
}
0
1 answers
I created a variable in the entity receiving Getts and Setts
Then I made this small change to the method;
And it worked!
0
Author: wladyband, 2019-05-07 11:19:01