From the Javadoc, the @QueryParam annotated type must either:
- Be a primitive type
- Have a constructor that accepts a single
Stringargument - Have a static method named
valueOforfromStringthat accepts a singleStringargument (see, for example,Integer.valueOf(String)) - Be
List<T>,Set<T>orSortedSet<T>, whereTsatisfies 2 or 3 above. The resulting collection is read-only.
For your case I would go with the second option by wrapping the enum in a simple class:
public class StatusList {
private List<STATUS> statusList;
public StatusList(String toParse) {
//code to split the parameter into a list of statuses
}
public List<STATUS> getStatusList() {
return this.statusList;
}
}
Then change your method to:
@GET
public Resource resource(@QueryParam("status") StatusList statusList){
}