I know that Java enums are compiled to classes with private constructors and a bunch of public static members. When comparing two members of a given enum, I've always used .equals(), ...
I would like to know how to use Enums in this case: I have to make a range comparison and I think Enums might be helpful here but not sure how to implement it. I want something like this (functionally): Enum STATUS{ STATUS1 (10,20), STATUS2 (20,30) } while in the program i need a call as this: int value = STATUS(12).getStatus(); ...
I've got an enum list of values: public static enum ValidRptSizeValues { INVOICE("invoice"), NATIVE_ALLOC("nativeAll"), CONVERTED("converted"), CONVERT_ALLOC("convertAll"), CONVERT_USED("convertUsed"); String reportCalcSource; ValidRptSizeValues(String rptCalcSource){ this.reportCalcSource = rptCalcSource; } } I've got an inbound parameter that I want to compare with these valid values and perform a specific action based on what it is. I've not found a good example of how to do this ...
I think I'm gonna have a problem delivering a short compilable code fragment for you as there is too many classes relying on each other and I can't translate all that code to english. Don't you have any ideas to comparing Enum? I'we read around a bit and they say (they say alot don't they) Enum is almost like int and ...