I came across this problem that I without knowing the actual enum type I need to iterate its possible values.
enum
if (value instanceof Enum){ Enu
Here, Role is an enum which contains the following values [ADMIN, USER, OTHER].
List<Role> roleList = Arrays.asList(Role.values()); roleList.forEach(role -> { System.out.println(role); });