GeezerVison is showing github.com — renaming refID to uid on Java side · MasterAlpha/objectbox-java@0d7bc54
File treeExpand file treeCollapse file tree Open diff view settings objectbox-java-api/src/main/java/io/objectbox/annotation objectbox-java/src/main/java/io/objectbox tests/objectbox-java-test/src/main/java/io/objectbox
Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: objectbox-java-api/src/main/java/io/objectbox/annotation/Entity.java +6-6Lines changed: 6 additions & 6 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 17 | 17 | * Specifies the name on the DB side (e.g. table name) this entity maps to. | 18 | 18 | * By default, the name is based on the entities class name. | 19 | 19 | * <p> | 20 | | - * Note: if you intent to rename an entity, consider using refId instead. | | 20 | + * Note: if you intent to rename an entity, consider using uid instead. | 21 | 21 | */ | 22 | 22 | String nameInDb() default ""; | 23 | 23 |
| | 56 | 56 | // Class protobuf() default void.class; | 57 | 57 |
| 58 | 58 | /** | 59 | | - * RefIDs identify entities (and properties) uniquely in the meta object model file (objectmodel.json). | 60 | | - * With refIDs you can map entities to their meta model representation in a stable way without its name. | 61 | | - * Once a refID is set, you can rename the entity as often as you like - ObjectBox keeps track of it automatically. | 62 | | - * Thus, it is advisable to lookup the refID in objectmodel.json and use it here before renaming a entity. | | 59 | + * UIDs identify entities (and properties) uniquely in the meta object model file (objectmodel.json). | | 60 | + * With UIDs you can map entities to their meta model representation in a stable way without its name. | | 61 | + * Once a UID is set, you can rename the entity as often as you like - ObjectBox keeps track of it automatically. | | 62 | + * Thus, it is advisable to lookup the UID in objectmodel.json and use it here before renaming a entity. | 63 | 63 | */ | 64 | | - long refId() default 0; | | 64 | + long uid() default 0; | 65 | 65 |
| 66 | 66 | } |
Collapse file Copy file name to clipboardExpand all lines: objectbox-java-api/src/main/java/io/objectbox/annotation/Property.java +6-7Lines changed: 6 additions & 7 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 15 | 15 | /** | 16 | 16 | * Name of the database column for this property. Default is field name. | 17 | 17 | * <p> | 18 | | - * Note: if you intent to rename a property, consider using refId instead. | | 18 | + * Note: if you intent to rename a property, consider using uid instead. | 19 | 19 | */ | 20 | 20 | String nameInDb() default ""; | 21 | 21 |
| 22 | | - | 23 | 22 | /** | 24 | | - * RefIDs identify properties (and entities) uniquely in the meta object model file (objectmodel.json). | 25 | | - * With refIDs you can map properties to their meta model representation in a stable way without its name. | 26 | | - * Once a refID is set, you can rename the properties as often as you like - ObjectBox keeps track of it automatically. | 27 | | - * Thus, it is advisable to lookup the refID in objectmodel.json and use it here before renaming a property. | | 23 | + * UIDs identify properties (and entities) uniquely in the meta object model file (objectmodel.json). | | 24 | + * With UIDs you can map properties to their meta model representation in a stable way without its name. | | 25 | + * Once a UID is set, you can rename the properties as often as you like - ObjectBox keeps track of it automatically. | | 26 | + * Thus, it is advisable to lookup the UID in objectmodel.json and use it here before renaming a property. | 28 | 27 | */ | 29 | | - long refId() default 0; | | 28 | + long uid() default 0; | 30 | 29 | } |
Collapse file Copy file name to clipboardExpand all lines: objectbox-java/src/main/java/io/objectbox/ModelBuilder.java +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -49,9 +49,9 @@ public PropertyBuilder indexId(int indexId) { | 49 | 49 | return this; | 50 | 50 | } | 51 | 51 |
| 52 | | - public PropertyBuilder refId(long refId) { | | 52 | + public PropertyBuilder uid(long refId) { | 53 | 53 | checkNotFinished(); | 54 | | - ModelProperty.addRefId(fbb, refId); | | 54 | + ModelProperty.addUid(fbb, refId); | 55 | 55 | return this; | 56 | 56 | } | 57 | 57 |
| |
Collapse file Copy file name to clipboardExpand all lines: objectbox-java/src/main/java/io/objectbox/model/ModelProperty.java +3-3Lines changed: 3 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 4 | 4 |
| 5 | 5 | import java.nio.*; | 6 | 6 | import java.lang.*; | 7 | | -import java.util.*; | | 7 | + | 8 | 8 | import com.google.flatbuffers.*; | 9 | 9 |
| 10 | 10 | @SuppressWarnings("unused") | @@ -42,7 +42,7 @@ public static int createModelProperty(FlatBufferBuilder builder, | 42 | 42 | long indexId, | 43 | 43 | int targetEntityOffset) { | 44 | 44 | builder.startObject(7); | 45 | | - ModelProperty.addRefId(builder, refId); | | 45 | + ModelProperty.addUid(builder, refId); | 46 | 46 | ModelProperty.addTargetEntity(builder, targetEntityOffset); | 47 | 47 | ModelProperty.addIndexId(builder, indexId); | 48 | 48 | ModelProperty.addFlags(builder, flags); | @@ -54,7 +54,7 @@ public static int createModelProperty(FlatBufferBuilder builder, | 54 | 54 |
| 55 | 55 | public static void startModelProperty(FlatBufferBuilder builder) { builder.startObject(7); } | 56 | 56 | public static void addName(FlatBufferBuilder builder, int nameOffset) { builder.addOffset(0, nameOffset, 0); } | 57 | | - public static void addRefId(FlatBufferBuilder builder, long refId) { builder.addLong(1, refId, 0L); } | | 57 | + public static void addUid(FlatBufferBuilder builder, long refId) { builder.addLong(1, refId, 0L); } | 58 | 58 | public static void addId(FlatBufferBuilder builder, long id) { builder.addInt(2, (int)id, (int)0L); } | 59 | 59 | public static void addType(FlatBufferBuilder builder, int type) { builder.addShort(3, (short)type, (short)0); } | 60 | 60 | public static void addFlags(FlatBufferBuilder builder, long flags) { builder.addInt(4, (int)flags, (int)0L); } | |
Collapse file Copy file name to clipboardExpand all lines: tests/objectbox-java-test/src/main/java/io/objectbox/AbstractObjectBoxTest.java +15-15Lines changed: 15 additions & 15 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -24,7 +24,7 @@ public abstract class AbstractObjectBoxTest { | 24 | 24 | protected boolean runExtensiveTests; | 25 | 25 | int lastEntityId; | 26 | 26 | int lastIndexId; | 27 | | - long lastRefId; | | 27 | + long lastUid; | 28 | 28 |
| 29 | 29 | @Before | 30 | 30 | public void setUp() throws IOException { | @@ -152,28 +152,28 @@ byte[] createTestModelWithTwoEntities(boolean withIndex) { | 152 | 152 | } | 153 | 153 |
| 154 | 154 | private void addTestEntity(ModelBuilder modelBuilder, boolean withIndex) { | 155 | | - EntityBuilder entityBuilder = modelBuilder.entity("TestEntity").id(++lastEntityId).refId(++lastRefId); | | 155 | + EntityBuilder entityBuilder = modelBuilder.entity("TestEntity").id(++lastEntityId).refId(++lastUid); | 156 | 156 | int pId = 0; | 157 | | - entityBuilder.property("id", PropertyType.Long).id(++pId).refId(++lastRefId).flags(PropertyFlags.ID); | 158 | | - entityBuilder.property("simpleBoolean", PropertyType.Bool).id(++pId).refId(++lastRefId); | 159 | | - entityBuilder.property("simpleByte", PropertyType.Byte).id(++pId).refId(++lastRefId); | 160 | | - entityBuilder.property("simpleShort", PropertyType.Short).id(++pId).refId(++lastRefId); | 161 | | - entityBuilder.property("simpleInt", PropertyType.Int).id(++pId).refId(++lastRefId); | 162 | | - entityBuilder.property("simpleLong", PropertyType.Long).id(++pId).refId(++lastRefId); | 163 | | - entityBuilder.property("simpleFloat", PropertyType.Float).id(++pId).refId(++lastRefId); | 164 | | - entityBuilder.property("simpleDouble", PropertyType.Double).id(++pId).refId(++lastRefId); | 165 | | - entityBuilder.property("simpleString", PropertyType.String).id(++pId).refId(++lastRefId) | | 157 | + entityBuilder.property("id", PropertyType.Long).id(++pId).uid(++lastUid).flags(PropertyFlags.ID); | | 158 | + entityBuilder.property("simpleBoolean", PropertyType.Bool).id(++pId).uid(++lastUid); | | 159 | + entityBuilder.property("simpleByte", PropertyType.Byte).id(++pId).uid(++lastUid); | | 160 | + entityBuilder.property("simpleShort", PropertyType.Short).id(++pId).uid(++lastUid); | | 161 | + entityBuilder.property("simpleInt", PropertyType.Int).id(++pId).uid(++lastUid); | | 162 | + entityBuilder.property("simpleLong", PropertyType.Long).id(++pId).uid(++lastUid); | | 163 | + entityBuilder.property("simpleFloat", PropertyType.Float).id(++pId).uid(++lastUid); | | 164 | + entityBuilder.property("simpleDouble", PropertyType.Double).id(++pId).uid(++lastUid); | | 165 | + entityBuilder.property("simpleString", PropertyType.String).id(++pId).uid(++lastUid) | 166 | 166 | .flags(withIndex ? PropertyFlags.INDEXED : 0).indexId(withIndex ? ++lastIndexId : 0); | 167 | | - entityBuilder.property("simpleByteArray", PropertyType.ByteVector).id(++pId).refId(++lastRefId); | | 167 | + entityBuilder.property("simpleByteArray", PropertyType.ByteVector).id(++pId).uid(++lastUid); | 168 | 168 | entityBuilder.lastPropertyId(pId); | 169 | 169 | entityBuilder.entityDone(); | 170 | 170 | } | 171 | 171 |
| 172 | 172 | private void addTestEntityMinimal(ModelBuilder modelBuilder, boolean withIndex) { | 173 | | - EntityBuilder entityBuilder = modelBuilder.entity("TestEntityMinimal").id(++lastEntityId).refId(++lastRefId); | | 173 | + EntityBuilder entityBuilder = modelBuilder.entity("TestEntityMinimal").id(++lastEntityId).refId(++lastUid); | 174 | 174 | int pId = 0; | 175 | | - entityBuilder.property("id", PropertyType.Long).id(++pId).refId(++lastRefId).flags(PropertyFlags.ID); | 176 | | - entityBuilder.property("text", PropertyType.String).id(++pId).refId(++lastRefId) | | 175 | + entityBuilder.property("id", PropertyType.Long).id(++pId).uid(++lastUid).flags(PropertyFlags.ID); | | 176 | + entityBuilder.property("text", PropertyType.String).id(++pId).uid(++lastUid) | 177 | 177 | .flags(withIndex ? PropertyFlags.INDEXED : 0).indexId(withIndex ? ++lastIndexId : 0); | 178 | 178 | entityBuilder.lastPropertyId(pId); | 179 | 179 | entityBuilder.entityDone(); | |
Collapse file Copy file name to clipboardExpand all lines: tests/objectbox-java-test/src/main/java/io/objectbox/relation/MyObjectBox.java +6-6Lines changed: 6 additions & 6 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -33,21 +33,21 @@ private static byte[] getModel() { | 33 | 33 |
| 34 | 34 | entityBuilder = modelBuilder.entity("Customer"); | 35 | 35 | entityBuilder.id(1).refId(3625336331812221361L).lastPropertyId(2); | 36 | | - entityBuilder.property("_id", PropertyType.Long).id(1).refId(1582995887554488290L) | | 36 | + entityBuilder.property("_id", PropertyType.Long).id(1).uid(1582995887554488290L) | 37 | 37 | .flags(PropertyFlags.ID | PropertyFlags.NOT_NULL); | 38 | | - entityBuilder.property("name", PropertyType.String).id(2).refId(3080561794084640807L) | | 38 | + entityBuilder.property("name", PropertyType.String).id(2).uid(3080561794084640807L) | 39 | 39 | .flags(PropertyFlags.INDEXED).indexId(1); | 40 | 40 | entityBuilder.entityDone(); | 41 | 41 |
| 42 | 42 |
| 43 | 43 | entityBuilder = modelBuilder.entity("ORDERS"); | 44 | 44 | entityBuilder.id(3).refId(4761318278698541254L).lastPropertyId(4); | 45 | | - entityBuilder.property("_id", PropertyType.Long).id(1).refId(4065349512068827171L) | | 45 | + entityBuilder.property("_id", PropertyType.Long).id(1).uid(4065349512068827171L) | 46 | 46 | .flags(PropertyFlags.ID | PropertyFlags.ID_SELF_ASSIGNABLE | PropertyFlags.NOT_NULL); | 47 | | - entityBuilder.property("date", PropertyType.Date).id(2).refId(1517800508838480650L); | 48 | | - entityBuilder.property("customerId", "Customer", PropertyType.Relation).id(3).refId(7549816757665526666L) | | 47 | + entityBuilder.property("date", PropertyType.Date).id(2).uid(1517800508838480650L); | | 48 | + entityBuilder.property("customerId", "Customer", PropertyType.Relation).id(3).uid(7549816757665526666L) | 49 | 49 | .flags(PropertyFlags.NOT_NULL | PropertyFlags.INDEXED | PropertyFlags.INDEX_PARTIAL_SKIP_ZERO).indexId(2); | 50 | | - entityBuilder.property("text", PropertyType.String).id(4).refId(4188485512096015343L); | | 50 | + entityBuilder.property("text", PropertyType.String).id(4).uid(4188485512096015343L); | 51 | 51 | entityBuilder.entityDone(); | 52 | 52 |
| 53 | 53 | return modelBuilder.build(); | |
|