Print enum field in JasperReports

2

I created a Enum that has a description field for each of your items.

In my report in Jaspersoft Studio I want to print this description field and not name() of Enum .

I created a field in the report, but when selecting the class type my Enum does not appear, so you can not select the .getDescricao() .

public enum Direcao {

    ENTRADA("Entrada"),
    SAIDA("Saída");

    private final String descricao;

    Direcao(String descricao) {
        this.descricao = descricao;
    }

    public String getDescricao() {
        return descricao;
    }
}
    
asked by anonymous 04.03.2015 / 17:29

1 answer

1

I've been able to sort out the type of field in its declaration in .jrxml and then you'll have access to Enum methods.

<field name="tipo" class="br.com.empresa.sistema.entity.Direcao"/>
    
04.03.2015 / 20:09