public abstract class RealmSchema extends Object
Realm.getSchema()
returns an immutable RealmSchema
which can only be used for inspecting. Use
DynamicRealm.getSchema()
to get a mutable schema.
All changes must happen inside a write transaction for the particular Realm.
RealmMigration
Modifier and Type | Method and Description |
---|---|
void |
close()
Deprecated.
RealmSchema doesn't have to be released manually. |
boolean |
contains(String className)
Checks if a given class already exists in the schema.
|
abstract RealmObjectSchema |
create(String className)
Adds a new class to the Realm.
|
abstract RealmObjectSchema |
get(String className)
Returns the
RealmObjectSchema for a given class. |
Set<RealmObjectSchema> |
getAll()
Returns the
RealmObjectSchema s for all RealmObject classes that can be saved in this Realm. |
abstract void |
remove(String className)
Removes a class from the Realm.
|
abstract RealmObjectSchema |
rename(String oldClassName,
String newClassName)
Renames a class already in the Realm.
|
@Deprecated public void close()
RealmSchema
doesn't have to be released manually.public abstract RealmObjectSchema get(String className)
RealmObjectSchema
for a given class. If this RealmSchema
is immutable, an immutable
RealmObjectSchema
will be returned. Otherwise, it returns an mutable RealmObjectSchema
.className
- name of the classnull
if the class doesn't exists.public Set<RealmObjectSchema> getAll()
RealmObjectSchema
s for all RealmObject classes that can be saved in this Realm. If this
RealmSchema
is immutable, an immutable RealmObjectSchema
set will be returned. Otherwise, it
returns an mutable RealmObjectSchema
set.public abstract RealmObjectSchema create(String className)
className
- name of the class.UnsupportedOperationException
- if this RealmSchema
is immutable.public abstract void remove(String className)
IllegalStateException
. Removes those classes or fields first.className
- name of the class to remove.UnsupportedOperationException
- if this RealmSchema
is immutable.public abstract RealmObjectSchema rename(String oldClassName, String newClassName)
oldClassName
- old class name.newClassName
- new class name.UnsupportedOperationException
- if this RealmSchema
is immutable.public boolean contains(String className)
className
- class name to check.true
if the class already exists. false
otherwise.