Docs Menu

Docs HomeDevelop ApplicationsAtlas Device SDKs

Annotation Type RealmClass

On this page

  • io.realm.annotations
  • Optional Element Summary
  • Element Detail

Implemented interfaces:

Interface used to mark a class that can be persisted by Realm.

Modifier and Type
Optional Element and Description
public boolean
Define objects of this type as "Embedded".
The naming policy applied to all fields in this class.
public String
Manually set the internal name used by Realm for this class.
public String
Manually set the internal name used by Realm for this class.
embedded

public boolean embedded

Define objects of this type as "Embedded". Embedded objects have a slightly different behavior than normal objects:

  • They must have exactly 1 parent linking to them when the embedded object is added to the Realm. Embedded objects can be the parent of other embedded objects. The parent cannot be changed later, except by copying the object.

  • They cannot have fields annotated with @PrimaryKey .

  • When a parent object is deleted, all embedded objects are also deleted.

  • It is possible to define an easy reference to the parent object using the @LinkingObjects annotation:

    @LinkingObjects
    public Parent parent;

Default: false

fieldNamingPolicy

public RealmNamingPolicy fieldNamingPolicy

The naming policy applied to all fields in this class. The default policy is RealmNamingPolicy.NO_POLICY .

It is possible to override the naming policy for each field by using the RealmField annotation.

Default: io.realm.annotations.RealmNamingPolicy.NO_POLICY

Tip

See also:

name

public String name

Manually set the internal name used by Realm for this class. If this class is part of any modules, this will also override any name policy set using RealmModule.classNamingPolicy() .

Default: ""

value

public String value

Manually set the internal name used by Realm for this class. If this class is part of any modules, this will also override any name policy set using RealmModule.classNamingPolicy() .

Default: ""

← Annotation Type PrimaryKey