mardi 18 décembre 2018

Get a static final field in scala with a string reference

Suppose I have a fully qualified reference string:

val location = "org.path.to.some.field"
val foo = getFieldFromString(location)

I want to get the same value as if I did:

import org.path.to.some.field

How do I do this? Does it make sense to use reflection?





Aucun commentaire:

Enregistrer un commentaire