oracle.kv

## Interface ValueBinding<T>

- Type Parameters:
    `T` - is the type of the deserialized object that is passed to `toValue` and returned by `toObject`. The specific type depends on the particular binding that is used.
  All Known Subinterfaces:
    AvroBinding<T>, GenericAvroBinding, JsonAvroBinding, RawAvroBinding, SpecificAvroBinding<T>

      public interface ValueBinding<T>

  Generic interface for translating between `Value`s (stored byte arrays) and typed objects representing that value. In other words, this interface is used for serialization and deserialization of `Value`s.

  A built-in `AvroBinding`, which is a `ValueBinding` subtype, may be obtained from the `AvroCatalog`. Or, the `ValueBinding` interface may be implemented directly by the application to create custom bindings, when the Avro data format is not used.

  WARNING: We strongly recommend using an `AvroBinding`. NoSQL DB will leverage Avro in the future to provide additional features and capabilities.

  Since:
    2.0
  See Also:
    `AvroBinding`, `AvroCatalog`

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `T` | `toObject(Value value)` After doing a read operation using a `KVStore` method, the user calls `toObject` with the `Value` obtained from the read operation.
    `Value` | `toValue(T object)` Before doing a write operation, the user calls `toValue` passing an object she wishes to store.

- - ### Method Detail

    - #### toObject

          T toObject(Value value)
                     throws RuntimeException

      After doing a read operation using a `KVStore` method, the user calls `toObject` with the `Value` obtained from the read operation.
      Parameters:
        `value` - the `Value` obtained from a `KVStore` read operation method.
      Returns:
        the deserialized object.
      Throws:
        `RuntimeException` - if a parameter value is disallowed by the binding; see `AvroBinding` for specific exceptions thrown when using the Avro format.

    - #### toValue

          Value toValue(T object)
                        throws RuntimeException

      Before doing a write operation, the user calls `toValue` passing an object she wishes to store. The resulting `Value` is then passed to the write operation method in `KVStore`.
      Parameters:
        `object` - the object the user wishes to store, or at least serialize.
      Returns:
        the serialized object.
      Throws:
        `RuntimeException` - if a parameter value is disallowed by the binding; see `AvroBinding` for specific exceptions thrown when using the Avro format.

Copyright (c) 2011, 2014 Oracle and/or its affiliates. All rights reserved.