KeyValueOperationContext (Apache Geode 1.4.0)
Date: 2018-01-29

org.apache.geode.cache.operations

## Class KeyValueOperationContext

- java.lang.Object
- - org.apache.geode.cache.operations.OperationContext
  - - org.apache.geode.cache.operations.KeyOperationContext
    - - org.apache.geode.cache.operations.KeyValueOperationContext

- Direct Known Subclasses:
    GetOperationContext, PutOperationContext

  Deprecated.
  since Geode1.0, use `ResourcePermission` instead

      public abstract class KeyValueOperationContext
      extends KeyOperationContext

  Encapsulates a region operation that requires both key and serialized value for the pre-operation and post-operation cases.
  Since:
    GemFire 5.5

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class org.apache.geode.cache.operations.OperationContext

      `OperationContext.OperationCode`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `KeyValueOperationContext(java.lang.Object key, java.lang.Object value, boolean isObject)` Deprecated. Constructor for the operation.
    `KeyValueOperationContext(java.lang.Object key, java.lang.Object value, boolean isObject, boolean postOperation)` Deprecated. Constructor for the operation.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.lang.Object` | `getDeserializedValue()` Deprecated. Get the deserialized value for this operation.
    `byte[]` | `getSerializedValue()` Deprecated. Get the serialized value for this operation.
    `java.lang.Object` | `getValue()` Deprecated. Get the value for this operation.
    `boolean` | `isObject()` Deprecated. Return true when the value is an object and not a raw byte array.
    `void` | `setSerializedValue(byte[] serializedValue, boolean isObject)` Deprecated. Set the serialized value object for this operation.
    `void` | `setValue(java.lang.Object value, boolean isObject)` Deprecated. Set the result value of the object for this operation.

    - ### Methods inherited from class org.apache.geode.cache.operations.KeyOperationContext

      `getCallbackArg, getKey, getOperationCode, isPostOperation, setCallbackArg, setPostOperation`

    - ### Methods inherited from class org.apache.geode.cache.operations.OperationContext

      `isClientUpdate, isClientUpdate`

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

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### KeyValueOperationContext

          public KeyValueOperationContext(java.lang.Object key,
                                          java.lang.Object value,
                                          boolean isObject)

      Deprecated.
      Constructor for the operation.
      Parameters:
        `key` - the key for this operation
        `value` - the value for this operation
        `isObject` - true when the value is an object; false when it is a raw byte array
      Since:
        GemFire 6.5

    - #### KeyValueOperationContext

          public KeyValueOperationContext(java.lang.Object key,
                                          java.lang.Object value,
                                          boolean isObject,
                                          boolean postOperation)

      Deprecated.
      Constructor for the operation.
      Parameters:
        `key` - the key for this operation
        `value` - the value for this operation
        `isObject` - true when the value is an object; false when it is a raw byte array
        `postOperation` - true if the context is at the time of sending updates
      Since:
        GemFire 6.5

  - ### Method Detail

    - #### getSerializedValue

          public byte[] getSerializedValue()

      Deprecated.
      Get the serialized value for this operation.
      Returns:
        the serialized value for this operation or null if the value is not serialized

    - #### getDeserializedValue

          public java.lang.Object getDeserializedValue()
                                                throws SerializationException

      Deprecated.
      Get the deserialized value for this operation. Note that if the value is serialized this method will attempt to deserialize it. If PDX read-serialized is set to true and the value was serialized with PDX then this method will return a PdxInstance.
      Returns:
        the deserialized value for this operation
      Throws:
        `SerializationException` - if deserialization of the value fails
      Since:
        Geode 1.0

    - #### getValue

          public java.lang.Object getValue()

      Deprecated.
      Get the value for this operation. Note that if the value is serialized then a byte array will be returned that contains the serialized bytes. To figure out if the returned byte array contains serialized bytes or is the deserialized value call `isObject()`. If you need to deserialize the serialized bytes use `DataSerializer.readObject(java.io.DataInput)` or you can just call `getDeserializedValue()`.
      Returns:
        the value for this operation
      Since:
        GemFire 6.5

    - #### isObject

          public boolean isObject()

      Deprecated.
      Return true when the value is an object and not a raw byte array.
      Returns:
        true when the value is an object; false when it is a raw byte array

    - #### setSerializedValue

          public void setSerializedValue(byte[] serializedValue,
                                         boolean isObject)

      Deprecated.
      Set the serialized value object for this operation.
      Parameters:
        `serializedValue` - the serialized value for this operation
        `isObject` - true when the value is an object; false when it is a raw byte array

    - #### setValue

          public void setValue(java.lang.Object value,
                               boolean isObject)

      Deprecated.
      Set the result value of the object for this operation.
      Parameters:
        `value` - the result of this operation; can be a serialized byte array or a deserialized object
        `isObject` - true when the value is an object (either serialized or deserialized); false when it is a raw byte array
      Since:
        GemFire 6.5