Scenario
I've got enums
UNDEFINED(-1),
FIS(0),
MANUELL(1)
defined as
public enum Ausloesungsart { UNDEFINED( -1), FIS( 0), MANUELL( 1); }
however at runtime i'm adding another enum if it's not contained in the list as UNDEFINED
with the parsed code, as in 123
.
Here is how I take the Enum:
public static Ausloesungsart fromIdentifier(Integer code) {
if (enumsByIdentifier.containsKey(code)) {
return enumsByIdentifier.get(code);
} else {
enumsByIdentifier.put(code, Ausloesungsart.UNDEFINED);
return enumsByIdentifier.get(code);
}
}
by now the list should contain
UNDEFINED(-1),
FIS(0),
MANUELL(1),
UNDEFINED(123)
when parsing the file it obviously sets the value 88 and searches for it. However it returns -1 in the end on the frontend.
Notice
It never even jumps into the else clausel, somehow it's already in?
Any idea what I'm missing?
Edit:
Where the parsing happens:
Ausloesung ausloesung = new Ausloesung(Ausloesungsart.fromIdentifier(header.getReleaseType()));
at this point, releaseType
is 123
but in the end there is -1 = Undefined
instead of
123 = Undefined
in the database and frontend.
Usecase:
Any Status not in the enumeration should be displayed in the frontend as in
<CODE> = Undefined
Currently the message is built with a property attribute:
my.properties:
Ausloesungsart.UNDEFINED= {0} \= Unbekannt
Ausloesungsart.FIS=0 \= FIS
Ausloesungsart.MANUELL=1 \= Manuell