From the Javadoc, the @QueryParam
annotated type must either:
- Be a primitive type
- Have a constructor that accepts a single
String
argument - Have a static method named
valueOf
orfromString
that accepts a singleString
argument (see, for example,Integer.valueOf(String)
) - Be
List<T>
,Set<T>
orSortedSet<T>
, whereT
satisfies 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){
}