Skip to content

Commit c6bd0c2

Browse files
More external types: add new enums #260
1 parent 4259c67 commit c6bd0c2

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

objectbox-java-api/src/main/java/io/objectbox/annotation/ExternalPropertyType.java

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ public enum ExternalPropertyType {
3131
*/
3232
INT_128,
3333
/**
34+
* A UUID (Universally Unique Identifier) as defined by RFC 9562.
35+
* <p>
36+
* ObjectBox uses the UUIDv7 scheme (timestamp + random) to create new UUIDs. UUIDv7 is a good choice for database
37+
* keys as it's mostly sequential and encodes a timestamp. However, if keys are used externally, consider
38+
* {@link #UUID_V4} for better privacy by not exposing any time information.
39+
* <p>
3440
* Representing type: ByteVector
3541
* <p>
3642
* Encoding: 1:1 binary representation (16 bytes)
@@ -44,6 +50,32 @@ public enum ExternalPropertyType {
4450
* Encoding: 1:1 binary representation (16 bytes)
4551
*/
4652
DECIMAL_128,
53+
/**
54+
* UUID represented as a string of 36 characters, e.g. "019571b4-80e3-7516-a5c1-5f1053d23fff".
55+
* <p>
56+
* For efficient storage, consider the {@link #UUID} type instead, which occupies only 16 bytes (20 bytes less).
57+
* This type may still be a convenient alternative as the string type is widely supported and more human-readable.
58+
* In accordance to standards, new UUIDs generated by ObjectBox use lowercase hexadecimal digits.
59+
* <p>
60+
* Representing type: String
61+
*/
62+
UUID_STRING,
63+
/**
64+
* A UUID (Universally Unique Identifier) as defined by RFC 9562.
65+
* <p>
66+
* ObjectBox uses the UUIDv4 scheme (completely random) to create new UUIDs.
67+
* <p>
68+
* Representing type: ByteVector
69+
* <p>
70+
* Encoding: 1:1 binary representation (16 bytes)
71+
*/
72+
UUID_V4,
73+
/**
74+
* Like {@link #UUID_STRING}, but using the UUIDv4 scheme (completely random) to create new UUID.
75+
* <p>
76+
* Representing type: String
77+
*/
78+
UUID_V4_STRING,
4779
/**
4880
* A key/value map; e.g. corresponds to a JSON object or a MongoDB document (although not keeping the key order).
4981
* Unlike the Flex type, this must contain a map value (e.g. not a vector or a scalar).

0 commit comments

Comments
 (0)