I have a following class
package myapp.model
case class Person(
name: String,
age: Option[Int]
)
I would like to implement following function:
def getFieldClass(className: String, fieldName:String): java.lang.Class = {
// case normal field return its class
// case Option field return generic type of Option
}
So that for following input:
- className="myapp.model.Person"
- fieldName="age"
the function will return class object: scala.Int
Aucun commentaire:
Enregistrer un commentaire