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`

  - ### 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.
    `<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

    - #### builder

          static Datastore.OperationResult.Builder builder()

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

Copyright © 2017 The Holon Platform. All rights reserved.