Skip to content

Commit e22dfe3

Browse files
committed
Update Flatbuffers to 1.12
1 parent bfae45c commit e22dfe3

File tree

11 files changed

+120
-56
lines changed

11 files changed

+120
-56
lines changed

objectbox-java/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ dependencies {
88
compile fileTree(include: ['*.jar'], dir: 'libs')
99
compile project(':objectbox-java-api')
1010
compile 'org.greenrobot:essentials:3.0.0-RC1'
11-
compile 'com.google.flatbuffers:flatbuffers-java:1.11.1'
11+
compile 'com.google.flatbuffers:flatbuffers-java:1.12.0'
1212
compile 'com.google.code.findbugs:jsr305:3.0.2'
1313
}
1414

objectbox-java/src/main/java/io/objectbox/DebugFlags.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2019 ObjectBox Ltd. All rights reserved.
2+
* Copyright 2020 ObjectBox Ltd. All rights reserved.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.

objectbox-java/src/main/java/io/objectbox/model/EntityFlags.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2019 ObjectBox Ltd. All rights reserved.
2+
* Copyright 2020 ObjectBox Ltd. All rights reserved.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.

objectbox-java/src/main/java/io/objectbox/model/IdUid.java

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2019 ObjectBox Ltd. All rights reserved.
2+
* Copyright 2020 ObjectBox Ltd. All rights reserved.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -23,12 +23,12 @@
2323
import java.util.*;
2424
import com.google.flatbuffers.*;
2525

26+
@SuppressWarnings("unused")
2627
/**
2728
* ID tuple: besides the main ID there is also a UID for verification
2829
*/
29-
@SuppressWarnings("unused")
3030
public final class IdUid extends Struct {
31-
public void __init(int _i, ByteBuffer _bb) { bb_pos = _i; bb = _bb; }
31+
public void __init(int _i, ByteBuffer _bb) { __reset(_i, _bb); }
3232
public IdUid __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
3333

3434
public long id() { return (long)bb.getInt(bb_pos + 0) & 0xFFFFFFFFL; }
@@ -45,5 +45,12 @@ public static int createIdUid(FlatBufferBuilder builder, long id, long uid) {
4545
builder.putInt((int)id);
4646
return builder.offset();
4747
}
48+
49+
public static final class Vector extends BaseVector {
50+
public Vector __assign(int _vector, int _element_size, ByteBuffer _bb) { __reset(_vector, _element_size, _bb); return this; }
51+
52+
public IdUid get(int j) { return get(new IdUid(), j); }
53+
public IdUid get(IdUid obj, int j) { return obj.__assign(__element(j), bb); }
54+
}
4855
}
4956

objectbox-java/src/main/java/io/objectbox/model/Model.java

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2019 ObjectBox Ltd. All rights reserved.
2+
* Copyright 2020 ObjectBox Ltd. All rights reserved.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -23,17 +23,18 @@
2323
import java.util.*;
2424
import com.google.flatbuffers.*;
2525

26+
@SuppressWarnings("unused")
2627
/**
2728
* A model describes all entities and other meta data.
2829
* The current model of an app is synced against ObjectBox's persisted schema.
2930
* The model itself is not persisted, and thus may change as long as both ends are consistent (Java and native).
3031
* There could be multiple models/schemas (one dbi per schema) in the future.
3132
*/
32-
@SuppressWarnings("unused")
3333
public final class Model extends Table {
34+
public static void ValidateVersion() { Constants.FLATBUFFERS_1_12_0(); }
3435
public static Model getRootAsModel(ByteBuffer _bb) { return getRootAsModel(_bb, new Model()); }
35-
public static Model getRootAsModel(ByteBuffer _bb, Model obj) { Constants.FLATBUFFERS_1_11_1(); _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); }
36-
public void __init(int _i, ByteBuffer _bb) { bb_pos = _i; bb = _bb; vtable_start = bb_pos - bb.getInt(bb_pos); vtable_size = bb.getShort(vtable_start); }
36+
public static Model getRootAsModel(ByteBuffer _bb, Model obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); }
37+
public void __init(int _i, ByteBuffer _bb) { __reset(_i, _bb); }
3738
public Model __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
3839

3940
/**
@@ -50,17 +51,19 @@ public final class Model extends Table {
5051
* User controlled version, not really used at the moment
5152
*/
5253
public long version() { int o = __offset(8); return o != 0 ? bb.getLong(o + bb_pos) : 0L; }
53-
public ModelEntity entities(int j) { return entities(new ModelEntity(), j); }
54-
public ModelEntity entities(ModelEntity obj, int j) { int o = __offset(10); return o != 0 ? obj.__assign(__indirect(__vector(o) + j * 4), bb) : null; }
54+
public io.objectbox.model.ModelEntity entities(int j) { return entities(new io.objectbox.model.ModelEntity(), j); }
55+
public io.objectbox.model.ModelEntity entities(io.objectbox.model.ModelEntity obj, int j) { int o = __offset(10); return o != 0 ? obj.__assign(__indirect(__vector(o) + j * 4), bb) : null; }
5556
public int entitiesLength() { int o = __offset(10); return o != 0 ? __vector_len(o) : 0; }
56-
public IdUid lastEntityId() { return lastEntityId(new IdUid()); }
57-
public IdUid lastEntityId(IdUid obj) { int o = __offset(12); return o != 0 ? obj.__assign(o + bb_pos, bb) : null; }
58-
public IdUid lastIndexId() { return lastIndexId(new IdUid()); }
59-
public IdUid lastIndexId(IdUid obj) { int o = __offset(14); return o != 0 ? obj.__assign(o + bb_pos, bb) : null; }
60-
public IdUid lastSequenceId() { return lastSequenceId(new IdUid()); }
61-
public IdUid lastSequenceId(IdUid obj) { int o = __offset(16); return o != 0 ? obj.__assign(o + bb_pos, bb) : null; }
62-
public IdUid lastRelationId() { return lastRelationId(new IdUid()); }
63-
public IdUid lastRelationId(IdUid obj) { int o = __offset(18); return o != 0 ? obj.__assign(o + bb_pos, bb) : null; }
57+
public io.objectbox.model.ModelEntity.Vector entitiesVector() { return entitiesVector(new io.objectbox.model.ModelEntity.Vector()); }
58+
public io.objectbox.model.ModelEntity.Vector entitiesVector(io.objectbox.model.ModelEntity.Vector obj) { int o = __offset(10); return o != 0 ? obj.__assign(__vector(o), 4, bb) : null; }
59+
public io.objectbox.model.IdUid lastEntityId() { return lastEntityId(new io.objectbox.model.IdUid()); }
60+
public io.objectbox.model.IdUid lastEntityId(io.objectbox.model.IdUid obj) { int o = __offset(12); return o != 0 ? obj.__assign(o + bb_pos, bb) : null; }
61+
public io.objectbox.model.IdUid lastIndexId() { return lastIndexId(new io.objectbox.model.IdUid()); }
62+
public io.objectbox.model.IdUid lastIndexId(io.objectbox.model.IdUid obj) { int o = __offset(14); return o != 0 ? obj.__assign(o + bb_pos, bb) : null; }
63+
public io.objectbox.model.IdUid lastSequenceId() { return lastSequenceId(new io.objectbox.model.IdUid()); }
64+
public io.objectbox.model.IdUid lastSequenceId(io.objectbox.model.IdUid obj) { int o = __offset(16); return o != 0 ? obj.__assign(o + bb_pos, bb) : null; }
65+
public io.objectbox.model.IdUid lastRelationId() { return lastRelationId(new io.objectbox.model.IdUid()); }
66+
public io.objectbox.model.IdUid lastRelationId(io.objectbox.model.IdUid obj) { int o = __offset(18); return o != 0 ? obj.__assign(o + bb_pos, bb) : null; }
6467

6568
public static void startModel(FlatBufferBuilder builder) { builder.startTable(8); }
6669
public static void addModelVersion(FlatBufferBuilder builder, long modelVersion) { builder.addInt(0, (int)modelVersion, (int)0L); }
@@ -79,5 +82,12 @@ public static int endModel(FlatBufferBuilder builder) {
7982
}
8083
public static void finishModelBuffer(FlatBufferBuilder builder, int offset) { builder.finish(offset); }
8184
public static void finishSizePrefixedModelBuffer(FlatBufferBuilder builder, int offset) { builder.finishSizePrefixed(offset); }
85+
86+
public static final class Vector extends BaseVector {
87+
public Vector __assign(int _vector, int _element_size, ByteBuffer _bb) { __reset(_vector, _element_size, _bb); return this; }
88+
89+
public Model get(int j) { return get(new Model(), j); }
90+
public Model get(Model obj, int j) { return obj.__assign(__indirect(__element(j), bb), bb); }
91+
}
8292
}
8393

objectbox-java/src/main/java/io/objectbox/model/ModelEntity.java

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2019 ObjectBox Ltd. All rights reserved.
2+
* Copyright 2020 ObjectBox Ltd. All rights reserved.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -25,24 +25,29 @@
2525

2626
@SuppressWarnings("unused")
2727
public final class ModelEntity extends Table {
28+
public static void ValidateVersion() { Constants.FLATBUFFERS_1_12_0(); }
2829
public static ModelEntity getRootAsModelEntity(ByteBuffer _bb) { return getRootAsModelEntity(_bb, new ModelEntity()); }
29-
public static ModelEntity getRootAsModelEntity(ByteBuffer _bb, ModelEntity obj) { Constants.FLATBUFFERS_1_11_1(); _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); }
30-
public void __init(int _i, ByteBuffer _bb) { bb_pos = _i; bb = _bb; vtable_start = bb_pos - bb.getInt(bb_pos); vtable_size = bb.getShort(vtable_start); }
30+
public static ModelEntity getRootAsModelEntity(ByteBuffer _bb, ModelEntity obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); }
31+
public void __init(int _i, ByteBuffer _bb) { __reset(_i, _bb); }
3132
public ModelEntity __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
3233

33-
public IdUid id() { return id(new IdUid()); }
34-
public IdUid id(IdUid obj) { int o = __offset(4); return o != 0 ? obj.__assign(o + bb_pos, bb) : null; }
34+
public io.objectbox.model.IdUid id() { return id(new io.objectbox.model.IdUid()); }
35+
public io.objectbox.model.IdUid id(io.objectbox.model.IdUid obj) { int o = __offset(4); return o != 0 ? obj.__assign(o + bb_pos, bb) : null; }
3536
public String name() { int o = __offset(6); return o != 0 ? __string(o + bb_pos) : null; }
3637
public ByteBuffer nameAsByteBuffer() { return __vector_as_bytebuffer(6, 1); }
3738
public ByteBuffer nameInByteBuffer(ByteBuffer _bb) { return __vector_in_bytebuffer(_bb, 6, 1); }
38-
public ModelProperty properties(int j) { return properties(new ModelProperty(), j); }
39-
public ModelProperty properties(ModelProperty obj, int j) { int o = __offset(8); return o != 0 ? obj.__assign(__indirect(__vector(o) + j * 4), bb) : null; }
39+
public io.objectbox.model.ModelProperty properties(int j) { return properties(new io.objectbox.model.ModelProperty(), j); }
40+
public io.objectbox.model.ModelProperty properties(io.objectbox.model.ModelProperty obj, int j) { int o = __offset(8); return o != 0 ? obj.__assign(__indirect(__vector(o) + j * 4), bb) : null; }
4041
public int propertiesLength() { int o = __offset(8); return o != 0 ? __vector_len(o) : 0; }
41-
public IdUid lastPropertyId() { return lastPropertyId(new IdUid()); }
42-
public IdUid lastPropertyId(IdUid obj) { int o = __offset(10); return o != 0 ? obj.__assign(o + bb_pos, bb) : null; }
43-
public ModelRelation relations(int j) { return relations(new ModelRelation(), j); }
44-
public ModelRelation relations(ModelRelation obj, int j) { int o = __offset(12); return o != 0 ? obj.__assign(__indirect(__vector(o) + j * 4), bb) : null; }
42+
public io.objectbox.model.ModelProperty.Vector propertiesVector() { return propertiesVector(new io.objectbox.model.ModelProperty.Vector()); }
43+
public io.objectbox.model.ModelProperty.Vector propertiesVector(io.objectbox.model.ModelProperty.Vector obj) { int o = __offset(8); return o != 0 ? obj.__assign(__vector(o), 4, bb) : null; }
44+
public io.objectbox.model.IdUid lastPropertyId() { return lastPropertyId(new io.objectbox.model.IdUid()); }
45+
public io.objectbox.model.IdUid lastPropertyId(io.objectbox.model.IdUid obj) { int o = __offset(10); return o != 0 ? obj.__assign(o + bb_pos, bb) : null; }
46+
public io.objectbox.model.ModelRelation relations(int j) { return relations(new io.objectbox.model.ModelRelation(), j); }
47+
public io.objectbox.model.ModelRelation relations(io.objectbox.model.ModelRelation obj, int j) { int o = __offset(12); return o != 0 ? obj.__assign(__indirect(__vector(o) + j * 4), bb) : null; }
4548
public int relationsLength() { int o = __offset(12); return o != 0 ? __vector_len(o) : 0; }
49+
public io.objectbox.model.ModelRelation.Vector relationsVector() { return relationsVector(new io.objectbox.model.ModelRelation.Vector()); }
50+
public io.objectbox.model.ModelRelation.Vector relationsVector(io.objectbox.model.ModelRelation.Vector obj) { int o = __offset(12); return o != 0 ? obj.__assign(__vector(o), 4, bb) : null; }
4651
/**
4752
* Can be language specific, e.g. if no-args constructor should be used
4853
*/
@@ -70,5 +75,12 @@ public static int endModelEntity(FlatBufferBuilder builder) {
7075
int o = builder.endTable();
7176
return o;
7277
}
78+
79+
public static final class Vector extends BaseVector {
80+
public Vector __assign(int _vector, int _element_size, ByteBuffer _bb) { __reset(_vector, _element_size, _bb); return this; }
81+
82+
public ModelEntity get(int j) { return get(new ModelEntity(), j); }
83+
public ModelEntity get(ModelEntity obj, int j) { return obj.__assign(__indirect(__element(j), bb), bb); }
84+
}
7385
}
7486

objectbox-java/src/main/java/io/objectbox/model/ModelProperty.java

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2019 ObjectBox Ltd. All rights reserved.
2+
* Copyright 2020 ObjectBox Ltd. All rights reserved.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -25,13 +25,14 @@
2525

2626
@SuppressWarnings("unused")
2727
public final class ModelProperty extends Table {
28+
public static void ValidateVersion() { Constants.FLATBUFFERS_1_12_0(); }
2829
public static ModelProperty getRootAsModelProperty(ByteBuffer _bb) { return getRootAsModelProperty(_bb, new ModelProperty()); }
29-
public static ModelProperty getRootAsModelProperty(ByteBuffer _bb, ModelProperty obj) { Constants.FLATBUFFERS_1_11_1(); _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); }
30-
public void __init(int _i, ByteBuffer _bb) { bb_pos = _i; bb = _bb; vtable_start = bb_pos - bb.getInt(bb_pos); vtable_size = bb.getShort(vtable_start); }
30+
public static ModelProperty getRootAsModelProperty(ByteBuffer _bb, ModelProperty obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); }
31+
public void __init(int _i, ByteBuffer _bb) { __reset(_i, _bb); }
3132
public ModelProperty __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
3233

33-
public IdUid id() { return id(new IdUid()); }
34-
public IdUid id(IdUid obj) { int o = __offset(4); return o != 0 ? obj.__assign(o + bb_pos, bb) : null; }
34+
public io.objectbox.model.IdUid id() { return id(new io.objectbox.model.IdUid()); }
35+
public io.objectbox.model.IdUid id(io.objectbox.model.IdUid obj) { int o = __offset(4); return o != 0 ? obj.__assign(o + bb_pos, bb) : null; }
3536
public String name() { int o = __offset(6); return o != 0 ? __string(o + bb_pos) : null; }
3637
public ByteBuffer nameAsByteBuffer() { return __vector_as_bytebuffer(6, 1); }
3738
public ByteBuffer nameInByteBuffer(ByteBuffer _bb) { return __vector_in_bytebuffer(_bb, 6, 1); }
@@ -40,8 +41,8 @@ public final class ModelProperty extends Table {
4041
* bit flags: e.g. indexed, not-nullable
4142
*/
4243
public long flags() { int o = __offset(10); return o != 0 ? (long)bb.getInt(o + bb_pos) & 0xFFFFFFFFL : 0L; }
43-
public IdUid indexId() { return indexId(new IdUid()); }
44-
public IdUid indexId(IdUid obj) { int o = __offset(12); return o != 0 ? obj.__assign(o + bb_pos, bb) : null; }
44+
public io.objectbox.model.IdUid indexId() { return indexId(new io.objectbox.model.IdUid()); }
45+
public io.objectbox.model.IdUid indexId(io.objectbox.model.IdUid obj) { int o = __offset(12); return o != 0 ? obj.__assign(o + bb_pos, bb) : null; }
4546
/**
4647
* For relations only: name of the target entity
4748
*/
@@ -79,5 +80,12 @@ public static int endModelProperty(FlatBufferBuilder builder) {
7980
int o = builder.endTable();
8081
return o;
8182
}
83+
84+
public static final class Vector extends BaseVector {
85+
public Vector __assign(int _vector, int _element_size, ByteBuffer _bb) { __reset(_vector, _element_size, _bb); return this; }
86+
87+
public ModelProperty get(int j) { return get(new ModelProperty(), j); }
88+
public ModelProperty get(ModelProperty obj, int j) { return obj.__assign(__indirect(__element(j), bb), bb); }
89+
}
8290
}
8391

objectbox-java/src/main/java/io/objectbox/model/ModelRelation.java

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2019 ObjectBox Ltd. All rights reserved.
2+
* Copyright 2020 ObjectBox Ltd. All rights reserved.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -25,18 +25,19 @@
2525

2626
@SuppressWarnings("unused")
2727
public final class ModelRelation extends Table {
28+
public static void ValidateVersion() { Constants.FLATBUFFERS_1_12_0(); }
2829
public static ModelRelation getRootAsModelRelation(ByteBuffer _bb) { return getRootAsModelRelation(_bb, new ModelRelation()); }
29-
public static ModelRelation getRootAsModelRelation(ByteBuffer _bb, ModelRelation obj) { Constants.FLATBUFFERS_1_11_1(); _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); }
30-
public void __init(int _i, ByteBuffer _bb) { bb_pos = _i; bb = _bb; vtable_start = bb_pos - bb.getInt(bb_pos); vtable_size = bb.getShort(vtable_start); }
30+
public static ModelRelation getRootAsModelRelation(ByteBuffer _bb, ModelRelation obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); }
31+
public void __init(int _i, ByteBuffer _bb) { __reset(_i, _bb); }
3132
public ModelRelation __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
3233

33-
public IdUid id() { return id(new IdUid()); }
34-
public IdUid id(IdUid obj) { int o = __offset(4); return o != 0 ? obj.__assign(o + bb_pos, bb) : null; }
34+
public io.objectbox.model.IdUid id() { return id(new io.objectbox.model.IdUid()); }
35+
public io.objectbox.model.IdUid id(io.objectbox.model.IdUid obj) { int o = __offset(4); return o != 0 ? obj.__assign(o + bb_pos, bb) : null; }
3536
public String name() { int o = __offset(6); return o != 0 ? __string(o + bb_pos) : null; }
3637
public ByteBuffer nameAsByteBuffer() { return __vector_as_bytebuffer(6, 1); }
3738
public ByteBuffer nameInByteBuffer(ByteBuffer _bb) { return __vector_in_bytebuffer(_bb, 6, 1); }
38-
public IdUid targetEntityId() { return targetEntityId(new IdUid()); }
39-
public IdUid targetEntityId(IdUid obj) { int o = __offset(8); return o != 0 ? obj.__assign(o + bb_pos, bb) : null; }
39+
public io.objectbox.model.IdUid targetEntityId() { return targetEntityId(new io.objectbox.model.IdUid()); }
40+
public io.objectbox.model.IdUid targetEntityId(io.objectbox.model.IdUid obj) { int o = __offset(8); return o != 0 ? obj.__assign(o + bb_pos, bb) : null; }
4041

4142
public static void startModelRelation(FlatBufferBuilder builder) { builder.startTable(3); }
4243
public static void addId(FlatBufferBuilder builder, int idOffset) { builder.addStruct(0, idOffset, 0); }
@@ -46,5 +47,12 @@ public static int endModelRelation(FlatBufferBuilder builder) {
4647
int o = builder.endTable();
4748
return o;
4849
}
50+
51+
public static final class Vector extends BaseVector {
52+
public Vector __assign(int _vector, int _element_size, ByteBuffer _bb) { __reset(_vector, _element_size, _bb); return this; }
53+
54+
public ModelRelation get(int j) { return get(new ModelRelation(), j); }
55+
public ModelRelation get(ModelRelation obj, int j) { return obj.__assign(__indirect(__element(j), bb), bb); }
56+
}
4957
}
5058

0 commit comments

Comments
 (0)