Signalling Protocols make frequent use of Enumerated types which have well defined integer values. E.g.
public enum IpHdrProtocol {
TCP(6),
SCTP(132),
MPLS(137);
int Value;
IpProtocol(int value) {
Value = value;
}
I am trying to find a way of de-serializing such a value to its corresponding Enumerated type using just the Enum Class type and the integer value for the instance.
If this requires a Static getEnumFromInt(int) function to be added to each enum then how can this 'interface' be defined so enum authors can ensure their enums can be serialized.
How can this best be done?