How do I get reference for a def
defined inside a object
.
object SomeObject {
def someMethod(x: String): String = s"Hello $x"
}
I want reference for someMethod
function.
What I tried so far:
val method = SomeObject.getClass.getDeclaredMethods.head
val function = method _
But this returns () => java.lang.reflect.Method = <function0>
instead of (String) => (String) = <function1>
.
TIA
Aucun commentaire:
Enregistrer un commentaire