title: Is it possible to get the parameter names of a method in scala
body: <p>As far as I know, we can't do this in Java. Can we do this in scala?</p>
  
  <p>Suppose there is a method as following:</p>
  
  <pre><code>def insert(name:String, age:Int) {
      // insert new user
  }
  </code></pre>
  
  <p>Is it possible to get the parameter names <code>name</code> and <code>age</code> in scala? </p>
  
  <hr>
  
  <p>UPDATE</p>
  
  <p>I want to do this, because I want to bind the parameters of methods automaticlly.</p>
  
  <p>For example, this is a web app, it has some actions defined as:</p>
  
  <pre><code>class UsersController extends Controller {
      def create(name: String, age: Int) {
            // insert the user
      }
  }
  </code></pre>
  
  <p>A client clicked the <code>submit</code> button of a creating-user form. The url will be <code>/users/create</code> and with some parameters sending.</p>
  
  <p>On the server side, when we get a url named <code>/users/create</code>, we will find a method <code>create</code> in the controller <code>UsersController</code>, found one now. Then I have to get the parameter names of that method, then we can get the values of them:</p>
  
  <pre><code>val params = getParamsFromRequest()
  val method = findMethodFromUrl("/users/create")
  val paramNames = getParamNamesOfMethod(method)
  val paramValues = getValues(params, paramNames)
  
  // then invoke
  method.invoke(controller, paramValues)
  </code></pre>
  
  <p>Now, the key is how to get the parameter names of a method? </p>