I'm migrating a desktop application in delphi to java, and in delphi has a class that persists in the bench the values 00, 10, 20 and 30. I'm doing an enum in java to persist values. I know that by annotation, I can define the string and ordinal strategies, but none of them will answer me.
What I have so far.
public enum Tipo {
tipo("00"),
tipo1("10"),
tipo2("20"),
tipo3("30");
String valor;
private Tipo(String valor) {
this.valor=valor;
}
public String getValor() {
return valor;
}
}
I would like to know if I'm on the way or if there is a better way to create this enum?