Is there a convenient way to get all the RealmObject subclass names in the database?
Yes. If you want all of them irrespectively if they are part of the schema or not you can do:
DynamicRealm.getInstance(config).getSchema().getAll().forEach { objSchema -> objSchema.getClassName() }
If you want all that are part of the schema you can do
Realm.getInstance(config).getSchema().getAll().forEach { objSchema -> objSchema.getClassName() }
Hey - looks like you forgot to add a T:* label - could you please add one?
Thanks,That is awesome!
the
forEach { objSchema -> objSchema.getName() }
should be
forEach { objSchema -> objSchema.getClassName() }
馃檪
Most helpful comment
Yes. If you want all of them irrespectively if they are part of the schema or not you can do:
If you want all that are part of the schema you can do