0
Look at the Grid
The record that is coming from the database is of an Enum class, the correct one was for the result in the grid to be printed name Value and not V.
This is the Enum;
VALOR("V", "Valor"),
PERCENTUAL("P", "Percentual"),
DIA("D", "Dia"),
HORA("H", "Hora");
I prefer to treat this Back-End problem rather than in Front-End, the Enum class is created as shown below because it will also be loaded in another part of the system as listbox, my idea would be when the value comes as V is automatically set as Value, when vier P was set automatically as Percentage and so on.
public enum EventoTipoMultiplicador implements EnumConverter<EventoTipoMultiplicador, String> {
VALOR("V", "Valor"),
PERCENTUAL("P", "Percentual"),
DIA("D", "Dia"),
HORA("H", "Hora");
private final String codigo;
private final String descricao;
public static final EnumValues<EventoTipoMultiplicador, String> VALORES = EnumUtils
.getEnumValuesMap(EventoTipoMultiplicador.class);
EventoTipoMultiplicador(String codigo, String descricao) {
this.codigo = codigo;
this.descricao = descricao;
}
@Override
@JsonValue
public String getValue() {
return codigo;
}
public String getDescricao() {
return descricao;
}
@JsonCreator
public static EventoTipoMultiplicador fromValue(String v) {
return EventoTipoMultiplicador.VALORES.getEnum(v);
}
}
These changes can be made here in this method below;
@JsonCreator
public static EventoTipoMultiplicador fromValue(String v) {
return EventoTipoMultiplicador.VALORES.getEnum(v);
}
When loading the GRID it displays the following result with the STS debug.
The problem is I don’t know how to change the method due to lack of experience.
You just want to return the Enum description?
– Adriano Gomes
I need return the description and the code.
– wladyband