Using integer values and String identifier in an Enum
So I currently have two enums:
public enum AuthorizationLevel {
FULL, HALF, NONE; };
public enum DatabaseLoggingLevel
{
HIGH,
MED,
LOW,
AUTH_ONLY,
NONE
}
I want to be able to associate integers with the values in the enums so
that I can have code like so:
if(databaseLoggingLevel < ClassName.DatabaseLoggingLevel.HIGH) return;
This is just so that certain logging is disabled when the level is less
than HIGH. I thought about making a helper function that returns an
integer value associated with each enum value with a switch statement, but
that seems hacky. Is there something I am missing?
No comments:
Post a Comment