Skip to content

Commit 897b9b4

Browse files
greenrobotgreenrobot-team
authored andcommitted
updates to FB properties model: ID_COMPANION flag, DateNano type
1 parent da6359d commit 897b9b4

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,5 +81,13 @@ private PropertyFlags() { }
8181
* Note: Don't combine with ID (IDs are always unsigned internally).
8282
*/
8383
public static final int UNSIGNED = 8192;
84+
/**
85+
* By defining an ID companion property, the entity type uses a special ID encoding scheme involving this property
86+
* in addition to the ID.
87+
*
88+
* For Time Series IDs, a companion property of type Date or DateNano represents the exact timestamp.
89+
* (Future idea: string hash IDs, with a String companion property to store the full string ID).
90+
*/
91+
public static final int ID_COMPANION = 16384;
8492
}
8593

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

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818

1919
package io.objectbox.model;
2020

21+
/**
22+
* Basic type of a property
23+
*/
2124
public final class PropertyType {
2225
private PropertyType() { }
2326
/**
@@ -34,14 +37,17 @@ private PropertyType() { }
3437
public static final short Double = 8;
3538
public static final short String = 9;
3639
/**
37-
* Internally stored as a 64 bit long(?)
40+
* Date/time stored as a 64 bit long representing milliseconds since 1970-01-01 (unix epoch)
3841
*/
3942
public static final short Date = 10;
4043
/**
4144
* Relation to another entity
4245
*/
4346
public static final short Relation = 11;
44-
public static final short Reserved1 = 12;
47+
/**
48+
* High precision date/time stored as a 64 bit long representing nanoseconds since 1970-01-01 (unix epoch)
49+
*/
50+
public static final short DateNano = 12;
4551
public static final short Reserved2 = 13;
4652
public static final short Reserved3 = 14;
4753
public static final short Reserved4 = 15;
@@ -61,8 +67,9 @@ private PropertyType() { }
6167
public static final short DoubleVector = 29;
6268
public static final short StringVector = 30;
6369
public static final short DateVector = 31;
70+
public static final short DateNanoVector = 32;
6471

65-
public static final String[] names = { "Unknown", "Bool", "Byte", "Short", "Char", "Int", "Long", "Float", "Double", "String", "Date", "Relation", "Reserved1", "Reserved2", "Reserved3", "Reserved4", "Reserved5", "Reserved6", "Reserved7", "Reserved8", "Reserved9", "Reserved10", "BoolVector", "ByteVector", "ShortVector", "CharVector", "IntVector", "LongVector", "FloatVector", "DoubleVector", "StringVector", "DateVector", };
72+
public static final String[] names = { "Unknown", "Bool", "Byte", "Short", "Char", "Int", "Long", "Float", "Double", "String", "Date", "Relation", "DateNano", "Reserved2", "Reserved3", "Reserved4", "Reserved5", "Reserved6", "Reserved7", "Reserved8", "Reserved9", "Reserved10", "BoolVector", "ByteVector", "ShortVector", "CharVector", "IntVector", "LongVector", "FloatVector", "DoubleVector", "StringVector", "DateVector", "DateNanoVector", };
6673

6774
public static String name(int e) { return names[e]; }
6875
}

0 commit comments

Comments
 (0)