Enum Class ExternalPropertyType

java.lang.Object
java.lang.Enum<ExternalPropertyType>
io.objectbox.annotation.ExternalPropertyType
All Implemented Interfaces:
Serializable, Comparable<ExternalPropertyType>, Constable

public enum ExternalPropertyType extends Enum<ExternalPropertyType>
A property type of an external system (e.g. another database) that has no default mapping to an ObjectBox type.

Use with @ExternalType.

  • Enum Constant Details

    • INT_128

      public static final ExternalPropertyType INT_128
      Representing type: ByteVector

      Encoding: 1:1 binary representation, little endian (16 bytes)

    • UUID

      public static final ExternalPropertyType UUID
      A UUID (Universally Unique Identifier) as defined by RFC 9562.

      ObjectBox uses the UUIDv7 scheme (timestamp + random) to create new UUIDs. UUIDv7 is a good choice for database keys as it's mostly sequential and encodes a timestamp. However, if keys are used externally, consider UUID_V4 for better privacy by not exposing any time information.

      Representing type: ByteVector

      Encoding: 1:1 binary representation (16 bytes)

    • DECIMAL_128

      public static final ExternalPropertyType DECIMAL_128
      IEEE 754 decimal128 type, e.g. supported by MongoDB.

      Representing type: ByteVector

      Encoding: 1:1 binary representation (16 bytes)

    • UUID_STRING

      public static final ExternalPropertyType UUID_STRING
      UUID represented as a string of 36 characters, e.g. "019571b4-80e3-7516-a5c1-5f1053d23fff".

      For efficient storage, consider the UUID type instead, which occupies only 16 bytes (20 bytes less). This type may still be a convenient alternative as the string type is widely supported and more human-readable. In accordance to standards, new UUIDs generated by ObjectBox use lowercase hexadecimal digits.

      Representing type: String

    • UUID_V4

      public static final ExternalPropertyType UUID_V4
      A UUID (Universally Unique Identifier) as defined by RFC 9562.

      ObjectBox uses the UUIDv4 scheme (completely random) to create new UUIDs.

      Representing type: ByteVector

      Encoding: 1:1 binary representation (16 bytes)

    • UUID_V4_STRING

      public static final ExternalPropertyType UUID_V4_STRING
      Like UUID_STRING, but using the UUIDv4 scheme (completely random) to create new UUID.

      Representing type: String

    • FLEX_MAP

      public static final ExternalPropertyType FLEX_MAP
      A key/value map; e.g. corresponds to a JSON object or a MongoDB document (although not keeping the key order). Unlike the Flex type, this must contain a map value (e.g. not a vector or a scalar).

      Representing type: Flex

      Encoding: Flex

    • FLEX_VECTOR

      public static final ExternalPropertyType FLEX_VECTOR
      A vector (aka list or array) of flexible elements; e.g. corresponds to a JSON array or a MongoDB array. Unlike the Flex type, this must contain a vector value (e.g. not a map or a scalar).

      Representing type: Flex

      Encoding: Flex

    • JSON

      public static final ExternalPropertyType JSON
      Placeholder (not yet used) for a JSON document.

      Representing type: String

    • BSON

      public static final ExternalPropertyType BSON
      Placeholder (not yet used) for a BSON document.

      Representing type: ByteVector

    • JAVASCRIPT

      public static final ExternalPropertyType JAVASCRIPT
      JavaScript source code.

      Representing type: String

    • JSON_TO_NATIVE

      public static final ExternalPropertyType JSON_TO_NATIVE
      A JSON string that is converted to a native "complex" representation in the external system.

      For example in MongoDB, embedded/nested documents are converted to a JSON string in ObjectBox and vice versa. This allows a quick and simple way to work with non-normalized data from MongoDB in ObjectBox. Alternatively, you can use FLEX_MAP and FLEX_VECTOR to map to language primitives (e.g. maps with string keys; not supported by all ObjectBox languages yet).

      For MongoDB, (nested) documents and arrays are supported.

      Note that this is very close to the internal representation, e.g. the key order is preserved (unlike Flex).

      Representing type: String

    • INT_128_VECTOR

      public static final ExternalPropertyType INT_128_VECTOR
      A vector (array) of Int128 values.
    • UUID_VECTOR

      public static final ExternalPropertyType UUID_VECTOR
      A vector (array) of Uuid values.
    • MONGO_ID

      public static final ExternalPropertyType MONGO_ID
      The 12-byte ObjectId type in MongoDB.

      Representing type: ByteVector

      Encoding: 1:1 binary representation (12 bytes)

    • MONGO_ID_VECTOR

      public static final ExternalPropertyType MONGO_ID_VECTOR
      A vector (array) of MongoId values.
    • MONGO_TIMESTAMP

      public static final ExternalPropertyType MONGO_TIMESTAMP
      Representing type: Long

      Encoding: Two unsigned 32-bit integers merged into a 64-bit integer.

    • MONGO_BINARY

      public static final ExternalPropertyType MONGO_BINARY
      Representing type: ByteVector

      Encoding: 3 zero bytes (reserved, functions as padding), fourth byte is the sub-type, followed by the binary data.

    • MONGO_REGEX

      public static final ExternalPropertyType MONGO_REGEX
      Representing type: string vector with 2 elements (index 0: pattern, index 1: options)

      Encoding: 1:1 string representation

  • Method Details

    • values

      public static ExternalPropertyType[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static ExternalPropertyType valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null