Watch Grid
TherecordthatiscomingfromthedatabaseisofanEnumclass,thecorrectonewasfortheresultinthegridtobeprintednamevalueandnotV.
ThisisEnum;
VALOR("V", "Valor"),
PERCENTUAL("P", "Percentual"),
DIA("D", "Dia"),
HORA("H", "Hora");
I'd rather treat this Back-End problem than in Front-End, the enum class is created as shown below because it will also be loaded into other parts of the system as listBox, my idea would be when the value comes as V was set automatically as Value, when 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 shows the following result with the STS debug.
The problem is that I do not know how to make change in the method due to lack of experience.