ENUM returning only the key and not the value

0

I'm trying in various ways to get the value of an ENUM, but it just returns me its "key." Below is the ENUM:

public enum SaleType {
    BOUGHT("Comprou"),
    SEND_BUDGET("Enviar Orçamento"),
    SUBMITTED_BUDGET("Orçamento Enviado"),
    NOT_WANTED("Não quis"),
    MAYBE_FUTURE("Pode Querer no Futuro");

    private final String sale ;

    private SaleType(String sale){
        this.sale=sale;
    }

    public String getSaleType(){
        return sale;
    }

}

For example, I want to get the "content" of SEND_BUDGET , then I made a loop in which it will grab all the values from my ENUM and make an IF to compare if the value hits ...

 for (SaleType s : SaleType.values()) {
    if (si.getSaleType().equals(s)) {
        String name = si.getSaleType();
        SaleType valueOf = s.valueOf(SaleType.class, name);
        System.out.println(valueOf);
    }
}

But the problem is that it will always return me the Ex key. SEND_BUDGET and not its corresponding "Send Budget" value.

It's probably a basic question, but I have tried some forms and no events.

    
asked by anonymous 18.03.2015 / 20:38

1 answer

1

Use as follows:

SaleType.SEND_BUDGET.getSaleType()
    
18.03.2015 / 20:41