Enum value as null

0

I have the following Enum :

@AllArgsConstructor
public enum Lojas {

    ALIEXPRESS("AliExpress"), MERCADO_LIVRE("Mercado Livre"), EBAY("Ebay"), WISH("Wish"), GEARBEST("Gearbest"), BANGOOD(
            "Banggood");

    @Getter
    @Setter
    private String nome;

}

I have this method that lists Enums:

public Collection<String> obterLojas() {
    Collection<Lojas> lojas = Arrays.asList(Lojas.values());
    Collection<String> nomeLojas = new ArrayList<String>();
    for (Lojas loja : lojas) {
        nomeLojas.add(loja.getNome());
    }
    return nomeLojas;
}

My screen that calls this method is the code:

<p:selectOneMenu id="loja" value="#{encomendaController.encomenda.loja}" required="true">
                                <f:selectItem itemLabel="" itemValue="" />
                                <f:selectItems value="#{enumHelper.obterLojas()}" var="bean" itemLabel="#{bean}" itemValue="#{bean}" />
                            </p:selectOneMenu>

My store attribute looks like this:

private String loja;

When I click on the selectOneMenu I can list the stores normally, after selecting and submitting my form, the value goes to null, does anyone know how I can solve?

    
asked by anonymous 21.03.2017 / 23:42

1 answer

0

I had not noticed but in one of the methods the object was lost and created another, so it was null, correct already.

    
23.03.2017 / 01:13