com.holonplatform.core.datastore

## Interface Datastore.OperationResult

- All Superinterfaces:
    Serializable
  Enclosing interface:
    Datastore

      public static interface Datastore.OperationResult
      extends Serializable

  Represents the result of a `Datastore` operation, providing informatons about the operation outcome.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Interface and Description
    --- | ---
    `static interface` | `Datastore.OperationResult.Builder` `Datastore.OperationResult` builder.

  - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method and Description
    --- | ---
    `static Datastore.OperationResult.Builder` | `builder()` Get a builder to create `Datastore.OperationResult` instances.
    `long` | `getAffectedCount()` Get the number of elements affected by the the operation execution.
    `default Optional<Object>` | `getFirstInsertedKey()` Get the first inserted key value, if available.
    `default <T> Optional<T>` | `getFirstInsertedKey(Class<T> targetType)` Get the first inserted key value given target type, if available.
    `<T> Optional<T>` | `getInsertedKey(Path<T> path)` For `Datastore.OperationType.INSERT` operations, returns the inserted key value which correspond to given `path` name, if available.
    `Map<Path<?>,Object>` | `getInsertedKeys()` For `Datastore.OperationType.INSERT` operations, returns the inserted key values, if the concrete `Datastore` implementation supports this feature.
    `Optional<Datastore.OperationType>` | `getOperationType()` Get the executed operation type, if available.

- - ### Method Detail

    - #### getOperationType

          Optional<Datastore.OperationType> getOperationType()

      Get the executed operation type, if available.
      Returns:
        Executed operation type

    - #### getAffectedCount

          long getAffectedCount()

      Get the number of elements affected by the the operation execution.
      Returns:
        Affected elements count

    - #### getInsertedKeys

          Map<Path<?>,Object> getInsertedKeys()

      For `Datastore.OperationType.INSERT` operations, returns the inserted key values, if the concrete `Datastore` implementation supports this feature. The returned `Map` key set is composed by the key `Path`s, associated with their values.

      This method can be used, for example, to obtain the auto-generated key values, if the concrete persistence store supports this feature.

      The key value type is a generic `Object`, it is up to the caller to convert the value to the expected actual type.

      Returns:
        Map of the insert keys `Path`s and their values, if available. An empty map if the operation is not a `Datastore.OperationType.INSERT` type operation or if the concrete `Datastore` implementation does not support this feature

    - #### getInsertedKey

          <T> Optional<T> getInsertedKey(Path<T> path)

      For `Datastore.OperationType.INSERT` operations, returns the inserted key value which correspond to given `path` name, if available.
      Type Parameters:
        `T` - Key type
      Parameters:
        `path` - Path for which to obtain the inserted key value
      Returns:
        Optional inserted key value
      Throws:
        `ClassCastException` - If the key value type is not compatible with the path type

    - #### getFirstInsertedKey

          default Optional<Object> getFirstInsertedKey()

      Get the first inserted key value, if available.
      Returns:
        Optional first inserted key value
      Since:
        5.1.0

    - #### getFirstInsertedKey

          default <T> Optional<T> getFirstInsertedKey(Class<T> targetType)

      Get the first inserted key value given target type, if available.
      Type Parameters:
        `T` - Expected value type
      Parameters:
        `targetType` - Expected value type (not null)
      Returns:
        Optional first inserted key value
      Since:
        5.1.0

    - #### builder

          static Datastore.OperationResult.Builder builder()

      Get a builder to create `Datastore.OperationResult` instances.
      Returns:
        OperationResult builder

Copyright © 2019 The Holon Platform. All rights reserved.