title: Is it possible to define a range for values of @PathVariable?
body: <p>I have a method as following, {code} should only accept A,B or C. </p>
  
  <p>I know that one way to solve it is to define three methods (one for each case) but thats is not an efficient way of doing this. Another approach is to use a single method that enclose a switch case, but is there any better approach to it?</p>
  
  <pre><code>@RequestMapping(value = "{code}/selection", method = RequestMethod.GET)
  public String showSelectionOptions(@PathVariable String code){
    switch(code){
      case A:
      case B:
      case C:
         return "selection";
      default:
         return "error";
  }
  </code></pre>