Annotation Interface Uid


@Retention(CLASS) @Target({FIELD,TYPE}) public @interface Uid
UIDs identify entities (and properties) uniquely in the meta object model file (objectbox-model/default.json). With UIDs you can map entities to their meta model representation in a stable way without its name. Once a UID is set, you can rename the entity as often as you like - ObjectBox keeps track of it automatically. Thus, it is advisable to lookup the UID in objectbox-model/default.json and use it here before renaming a entity.
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    long
    The UID associated with an entity/property.
  • Element Details

    • value

      long value
      The UID associated with an entity/property.

      Special values:

      • empty (or zero): and the ObjectBox Gradle plugin will set it automatically to the current value.
      • -1: will assign a new ID and UID forcing the property/entity to be treated as new (for entities: all property IDs and UIDs will be renewed too)
      Default:
      0L