I have following problem:

need to use enum in my java code, since I'll have to ask in my business logic things like if(someting == enumname.VALUE_ENUM){... but I don't have all the enum types at the compile time - that is I have them but there is too many enum types that I won't use in my business logic except in cases where I need to loop over all of the enum values for(enumname var : enumname.value()){...

This seems more like the real entity then (since in DB it has an Id and a lot more properties), but it looks ugly to type if(something == object.getByString("VALUE_ENUM"))

Is there some more pedant way of doing it?

1 Answer 1


found solution here if anybody needs it...


and this is the one with compile-time solution:


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.