org.apache.geode

## Class DeltaTestImpl

- java.lang.Object
- - org.apache.geode.DeltaTestImpl

- All Implemented Interfaces:
    java.io.Serializable, DataSerializable, Delta

      public class DeltaTestImpl
      extends java.lang.Object
      implements DataSerializable, Delta

  Sample test class which implements Delta.
  Since:
    GemFire 6.1
  See Also:
    Serialized Form

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface org.apache.geode.DataSerializable

      `DataSerializable.Replaceable`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `ERRONEOUS_INT_FOR_TO_DELTA`
    `static java.lang.String` | `ERRONEOUS_STRING_FOR_FROM_DELTA` Below fields are not part of standard Delta implementation but are used for testing purpose.
    `static boolean` | `NEED_TO_RESET_T0_DELTA`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `DeltaTestImpl()`
    `DeltaTestImpl(int intVal, java.lang.String str)`
    `DeltaTestImpl(int intVal, java.lang.String string, java.lang.Double doubleVal, byte[] bytes, org.apache.geode.internal.cache.TestObjectWithIdentifier testObj)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `checkInvalidInt(int intVal)`
    `protected void` | `checkInvalidInt2(int intVal)`
    `protected void` | `checkInvalidString(java.lang.String str)`
    `static java.lang.Boolean` | `deltaFeatureUsed()`
    `boolean` | `equals(java.lang.Object other)`
    `void` | `fromData(java.io.DataInput in)` Reads the state of this object as primitive data from the given `DataInput`.
    `void` | `fromDelta(java.io.DataInput in)` This method is invoked on an existing application object when an update is received as a delta.
    `static java.lang.Boolean` | `fromDeltaFeatureUsed()`
    `byte[]` | `getByteArr()`
    `java.lang.Double` | `getDoubleVar()`
    `static java.lang.Long` | `getFromDeltaFailures()`
    `static java.lang.Long` | `getFromDeltaInvokations()`
    `static java.util.List<java.lang.Exception>` | `getInstantiations()`
    `int` | `getIntVar()`
    `java.lang.String` | `getStr()`
    `org.apache.geode.internal.cache.TestObjectWithIdentifier` | `getTestObj()`
    `static long` | `getTimesConstructed()`
    `static java.lang.Long` | `getToDeltaFailures()`
    `static java.lang.Long` | `getToDeltaInvokations()`
    `boolean` | `hasDelta()` Returns true if this object has pending changes it can write out.
    `static java.lang.Boolean` | `isFromDeltaFailure()`
    `static java.lang.Boolean` | `isToDeltaFailure()`
    `static void` | `resetDeltaInvokationCounters()` Below methods are not part of standard Delta implementation but are used for testing purpose.
    `void` | `resetDeltaStatus()`
    `static void` | `resetFailureCounter()`
    `static void` | `resetFromDeltaCounter()`
    `static void` | `resetToDeltaCounter()`
    `void` | `setByteArr(byte[] bytes)`
    `void` | `setDoubleVar(java.lang.Double doubleVar)`
    `void` | `setIntVar(int intVar)`
    `void` | `setStr(java.lang.String str)`
    `void` | `setTestObj(org.apache.geode.internal.cache.TestObjectWithIdentifier testObj)`
    `static void` | `setTimesConstructed(long cnt)`
    `void` | `toData(java.io.DataOutput out)` Writes the state of this object as primitive data to the given `DataOutput`.
    `void` | `toDelta(java.io.DataOutput out)` This method is invoked on an application object at the delta sender, if GemFire determines the presence of a delta by calling `Delta.hasDelta()` on the object.
    `static java.lang.Boolean` | `toDeltaFeatureUsed()`
    `java.lang.String` | `toString()`

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

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

- - ### Field Detail

    - #### ERRONEOUS_STRING_FOR_FROM_DELTA

          public static final java.lang.String ERRONEOUS_STRING_FOR_FROM_DELTA

      Below fields are not part of standard Delta implementation but are used for testing purpose.
      See Also:
        Constant Field Values

    - #### ERRONEOUS_INT_FOR_TO_DELTA

          public static final int ERRONEOUS_INT_FOR_TO_DELTA

      See Also:
        Constant Field Values

    - #### NEED_TO_RESET_T0_DELTA

          public static boolean NEED_TO_RESET_T0_DELTA

  - ### Constructor Detail

    - #### DeltaTestImpl

          public DeltaTestImpl()

    - #### DeltaTestImpl

          public DeltaTestImpl(int intVal,
                               java.lang.String str)

    - #### DeltaTestImpl

          public DeltaTestImpl(int intVal,
                               java.lang.String string,
                               java.lang.Double doubleVal,
                               byte[] bytes,
                               org.apache.geode.internal.cache.TestObjectWithIdentifier testObj)

  - ### Method Detail

    - #### getInstantiations

          public static java.util.List<java.lang.Exception> getInstantiations()

    - #### getTimesConstructed

          public static long getTimesConstructed()

    - #### setTimesConstructed

          public static void setTimesConstructed(long cnt)

    - #### resetDeltaStatus

          public void resetDeltaStatus()

    - #### getByteArr

          public byte[] getByteArr()

    - #### setByteArr

          public void setByteArr(byte[] bytes)

    - #### getDoubleVar

          public java.lang.Double getDoubleVar()

    - #### setDoubleVar

          public void setDoubleVar(java.lang.Double doubleVar)

    - #### getIntVar

          public int getIntVar()

    - #### setIntVar

          public void setIntVar(int intVar)

    - #### getStr

          public java.lang.String getStr()

    - #### setStr

          public void setStr(java.lang.String str)

    - #### getTestObj

          public org.apache.geode.internal.cache.TestObjectWithIdentifier getTestObj()

    - #### setTestObj

          public void setTestObj(org.apache.geode.internal.cache.TestObjectWithIdentifier testObj)

    - #### resetDeltaInvokationCounters

          public static void resetDeltaInvokationCounters()

      Below methods are not part of standard Delta implementation but are used for testing purpose.

    - #### resetToDeltaCounter

          public static void resetToDeltaCounter()

    - #### resetFromDeltaCounter

          public static void resetFromDeltaCounter()

    - #### resetFailureCounter

          public static void resetFailureCounter()

    - #### deltaFeatureUsed

          public static java.lang.Boolean deltaFeatureUsed()

    - #### toDeltaFeatureUsed

          public static java.lang.Boolean toDeltaFeatureUsed()

    - #### getFromDeltaInvokations

          public static java.lang.Long getFromDeltaInvokations()

    - #### getToDeltaInvokations

          public static java.lang.Long getToDeltaInvokations()

    - #### fromDeltaFeatureUsed

          public static java.lang.Boolean fromDeltaFeatureUsed()

    - #### isFromDeltaFailure

          public static java.lang.Boolean isFromDeltaFailure()

    - #### isToDeltaFailure

          public static java.lang.Boolean isToDeltaFailure()

    - #### getFromDeltaFailures

          public static java.lang.Long getFromDeltaFailures()

    - #### getToDeltaFailures

          public static java.lang.Long getToDeltaFailures()

    - #### checkInvalidString

          protected void checkInvalidString(java.lang.String str)

    - #### checkInvalidInt

          protected void checkInvalidInt(int intVal)

    - #### checkInvalidInt2

          protected void checkInvalidInt2(int intVal)

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `java.lang.Object`

    - #### equals

          public boolean equals(java.lang.Object other)

      Overrides:
        `equals` in class `java.lang.Object`

    - #### fromDelta

          public void fromDelta(java.io.DataInput in)
                         throws java.io.IOException

      Description copied from interface: `Delta`
      This method is invoked on an existing application object when an update is received as a delta. This method throws an `InvalidDeltaException` when the delta in the `DataInput` cannot be applied to the object. GemFire automatically handles an `InvalidDeltaException` by reattempting the update by sending the full application object.
      Specified by:
        `fromDelta` in interface `Delta`
      Throws:
        `java.io.IOException`

    - #### hasDelta

          public boolean hasDelta()

      Description copied from interface: `Delta`
      Returns true if this object has pending changes it can write out.
      Specified by:
        `hasDelta` in interface `Delta`

    - #### toDelta

          public void toDelta(java.io.DataOutput out)
                       throws java.io.IOException

      Description copied from interface: `Delta`
      This method is invoked on an application object at the delta sender, if GemFire determines the presence of a delta by calling `Delta.hasDelta()` on the object. The delta is written to the `DataOutput` object provided by GemFire. Any delta state should be reset in this method.
      Specified by:
        `toDelta` in interface `Delta`
      Throws:
        `java.io.IOException`

    - #### fromData

          public void fromData(java.io.DataInput in)
                        throws java.io.IOException,
                               java.lang.ClassNotFoundException

      Description copied from interface: `DataSerializable`
      Reads the state of this object as primitive data from the given `DataInput`.
      Specified by:
        `fromData` in interface `DataSerializable`
      Throws:
        `java.io.IOException` - A problem occurs while reading from `in`
        `java.lang.ClassNotFoundException` - A class could not be loaded while reading from `in`

    - #### toData

          public void toData(java.io.DataOutput out)
                      throws java.io.IOException

      Description copied from interface: `DataSerializable`
      Writes the state of this object as primitive data to the given `DataOutput`.

      Since 5.7 it is possible for any method call to the specified `DataOutput` to throw `GemFireRethrowable`. It should not be caught by user code. If it is it must be rethrown.

      Specified by:
        `toData` in interface `DataSerializable`
      Throws:
        `java.io.IOException` - A problem occurs while writing to `out`