title: Android Room type convert multiple enum types
body: <p>I am writing a type converter for my Room database. I have a couple custom enum classes and I want to convert all of them to its ordinals when stored in the database. So, instead of writing the following for every single class, is there any way to simplify it (such as pass in a generic enum type)?</p>
  
  <pre><code>class Converter {
  
      @TypeConverter
      fun toOrdinal(type: TypeA): Int = type.ordinal
  
      @TypeConverter
      fun toTypeA(ordinal: Int): TypeA = TypeA.values().first { it.ordinal == ordinal }
  
      @TypeConverter
      fun toOrdinal(type: TypeB): Int = type.ordinal
  
      @TypeConverter
      fun toTypeB(ordinal: Int): TypeB = TypeB.values().first { it.ordinal == ordinal }
  
      ...
  }
  </code></pre>