com.google.appengine.api.datastore

## Enum DatastoreService.KeyRangeState

- java.lang.Object
- - java.lang.Enum<DatastoreService.KeyRangeState>
  - - com.google.appengine.api.datastore.DatastoreService.KeyRangeState

- All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<DatastoreService.KeyRangeState>
  Enclosing interface:
    DatastoreService

      public static enum DatastoreService.KeyRangeState
      extends java.lang.Enum<DatastoreService.KeyRangeState>

  Indicates the state of a `KeyRange`.
  See Also:
    `DatastoreService.allocateIdRange(KeyRange)`

- - ### Enum Constant Summary

    Enum Constants
    Enum Constant and Description
    `COLLISION` Indicates that entities with keys inside the given `KeyRange` already exist and writing to this range will overwrite those entities.
    `CONTENTION` Indicates the given `KeyRange` is empty but the datastore's automatic ID allocator may assign new entities keys in this range.
    `EMPTY` Indicates the given `KeyRange` is empty and the datastore's automatic ID allocator will not assign keys in this range to new entities.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static DatastoreService.KeyRangeState` | `valueOf(java.lang.String name)` Returns the enum constant of this type with the specified name.
    `static DatastoreService.KeyRangeState[]` | `values()` Returns an array containing the constants of this enum type, in the order they are declared.

    - ### Methods inherited from class java.lang.Enum

      `compareTo, equals, getDeclaringClass, hashCode, name, ordinal, toString, valueOf`

    - ### Methods inherited from class java.lang.Object

      `getClass, notify, notifyAll, wait, wait, wait`

- - ### Enum Constant Detail

    - #### EMPTY

          public static final DatastoreService.KeyRangeState EMPTY

      Indicates the given `KeyRange` is empty and the datastore's automatic ID allocator will not assign keys in this range to new entities.

    - #### CONTENTION

          public static final DatastoreService.KeyRangeState CONTENTION

      Indicates the given `KeyRange` is empty but the datastore's automatic ID allocator may assign new entities keys in this range. However it is safe to manually assign `Keys` in this range if either of the following is true:
      - No other request will insert entities with the same kind and parent as the given `KeyRange` until all entities with manually assigned keys from this range have been written.
      - Overwriting entities written by other requests with the same kind and parent as the given `KeyRange` is acceptable.

      The datastore's automatic ID allocator will not assign a key to a new entity that will overwrite an existing entity, so once the range is populated there will no longer be any contention.

    - #### COLLISION

          public static final DatastoreService.KeyRangeState COLLISION

      Indicates that entities with keys inside the given `KeyRange` already exist and writing to this range will overwrite those entities. Additionally the implications of `CONTENTION` apply. If overwriting entities that exist in this range is acceptable it is safe to use the given range.

      The datastore's automatic ID allocator will never assign a key to a new entity that will overwrite an existing entity so entities written by the user to this range will never be overwritten by an entity with an automatically assigned key.

  - ### Method Detail

    - #### values

          public static DatastoreService.KeyRangeState[] 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 (DatastoreService.KeyRangeState c : DatastoreService.KeyRangeState.values())
              System.out.println(c);

      Returns:
        an array containing the constants of this enum type, in the order they are declared

    - #### valueOf

          public static DatastoreService.KeyRangeState 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