Print Enum field in Jasperreports

Asked

Viewed 914 times

2

I created a Enum which has a description field for each of its items.

In my report on Jaspersoft Studio i want to print this description field and not the name() of Enum.

I created a field in the report, but when selecting the class type does not show my Enum then there is no way to 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;
    }
}

1 answer

1


I figured it out, you can force the guy field in his statement in .jrxml and from that you will have access to the methods of Enum.

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

Browser other questions tagged

You are not signed in. Login or sign up in order to post.