Using enums generically

More specifically, I am able to make a generic field that uses enums, but am not able to instantiate new values. This is the core functionality I'm looking for (the abillity to persist these properties to/from JSON and a database).

class EnumField<T : Enum<T>>(var value : T) {
    fun get(thisRef: Any?, prop: PropertyMetadata): T {
        return value
    }

  fun set(thisRef: Any?, prop: PropertyMetadata, newValue: T) {
  value = newValue
  }
  
  fun fromString(raw : String) {
  value = // create a new value from raw
  }
}


So, I can’t figure out how to implement the function fromString().