I have an Enum like this
package com.example;
public enum CoverageEnum {
COUNTRY,
REGIONAL,
COUNTY
}
I would like to iterate
If you're using Spring MVC, you can accomplish your goal with the following syntactic blessing:
Cluster Type
where your model attribute (ie, bean/data entity to populate) is named cluster and you have already populated the model with an enum array of values named clusterTypes. The
part is very much optional.
In Spring MVC land, you can also auto-populate clusterTypes
into your model like this
@ModelAttribute("clusterTypes")
public MyClusterType[] populateClusterTypes() {
return MyClusterType.values();
}