title: How can I create an instance of a Case Class with constructor arguments with no Parameters in Scala?
body: <p>I'm making a Scala app that sets by reflection field values. This works OK.</p>
  
  <p>However, in order to set field values I need a created instance. If I have a class with an empty constructor, I can do this easily with classOf[Person].getConstructors....</p>
  
  <p>However, when I try doing this with a Case class with a non empty constructor It doesn't work. I have all of the field names and its values, as well as the Object type I need to create. Can I instance the Case Class somehow with what I've got? </p>
  
  <p>The only thing I don't have is the parameter names from the Case Class constructor or a way to create this without parameter and then setting the values via reflection.</p>
  
  <p>Let's go to the example.</p>
  
  <p>I have the following</p>
  
  <pre><code>case class Person(name : String, age : Int)
  class Dog(name : String) {
      def this() = {
          name = "Tony"
      }
  }
  
  class Reflector[O](obj : O) {
  
      def setValue[F](propName : String, value : F) = ...
  
      def getValue(propName : String) = ...
  }
  
  //This works
  val dog = classOf[Dog].newInstance()
  new Reflector(dog).setValue("name", "Doggy")
  
  //This doesn't
  val person = classOf[Person].newInstance //Doesn't work
  
  val ctor = classOf[Person].getConstructors()(0)
  val ctor.newInstance(parameters) //I have the property names and values, but I don't know 
  // which of them is for each parameter, nor I name the name of the constructor parameters
  </code></pre>