Enum IndexType

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<IndexType>

    public enum IndexType
    extends java.lang.Enum<IndexType>
    ObjectBox offers a value and two hash index types, from which it chooses a reasonable default (see DEFAULT).

    For some queries/use cases it might make sense to override the default choice for optimization purposes.

    Note: hash indexes are currently only supported for string properties.

    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
      DEFAULT
      Use the default index type depending on the property type: VALUE for scalars and HASH for Strings.
      HASH
      Use a (fast non-cryptographic) hash of the property value to build the index.
      HASH64
      Use a long (fast non-cryptographic) hash of the property value to build the index.
      VALUE
      Use the property value to build the index.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static IndexType valueOf​(java.lang.String name)
      Returns the enum constant of this type with the specified name.
      static IndexType[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      • Methods inherited from class java.lang.Enum

        clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
    • Enum Constant Detail

      • DEFAULT

        public static final IndexType DEFAULT
        Use the default index type depending on the property type: VALUE for scalars and HASH for Strings.
      • VALUE

        public static final IndexType VALUE
        Use the property value to build the index. For Strings this may occupy more space than the default setting.
      • HASH

        public static final IndexType HASH
        Use a (fast non-cryptographic) hash of the property value to build the index. Internally, it uses a 32 bit hash with a decent hash collision behavior. Because occasional collisions do not really impact performance, this is usually a better choice than HASH64 as it takes less space.
      • HASH64

        public static final IndexType HASH64
        Use a long (fast non-cryptographic) hash of the property value to build the index.
    • Method Detail

      • values

        public static IndexType[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (IndexType c : IndexType.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static IndexType valueOf​(java.lang.String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (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:
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        java.lang.NullPointerException - if the argument is null