Iโve been late a year and a half. But I see that I did not answer this question.
The solution will use a class instead of enum, which has these two enumerations as its fields:
class Operation { Quantity quantity; Type type; Operation(Quantity quantity, Type type) { this.quantity = quantity; this.type = type; } }
You can, of course, use an enumeration instead of a class. Then you will need to list all the combinations:
enum Operation { SINGLE_GET(Quantity.SINGLE, Type.GET) SINGLE_POST(Quantity.SINGLE, Type.POST) MULTIPLE_GET(Quantity.MULTIPLE, Type.GET) // ... more options // contents same as in class Operation, constructor private by default }
Both approaches are valid, sometimes you really want to list all the combinations most of the time, however you should probably stick with the class approach.
For brevity, I did not define the Quantity and Type enumerations, these are just simple enumerations.
Vlasec
source share