Converter (Oracle - Berkeley DB Java API)
Date: 2020-06-01

Package com.sleepycat.persist.evolve

## Class Converter

- java.lang.Object
- - com.sleepycat.persist.evolve.Mutation
  - - com.sleepycat.persist.evolve.Converter

- All Implemented Interfaces:
    `java.io.Serializable`
  Direct Known Subclasses:
    `EntityConverter`

      public class Converter
      extends Mutation

  A mutation for converting an old version of an object value to conform to the current class or field definition. For example:

        package my.package;

        // The old class.  Version 0 is implied.
        //
        @Entity
        class Person {
            // ...
        }

        // The new class.  A new version number must be assigned.
        //
        @Entity(version=1)
        class Person {
            // Incompatible changes were made here...
        }

        // Add a converter mutation.
        //
        Mutations mutations = new Mutations();

        mutations.addConverter(new Converter(Person.class.getName(), 0,
                                             new MyConversion()));

        // Configure the mutations as described here.

  See `Conversion` for more information.

  See Also:
    `Class Evolution`, Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `Converter​(java.lang.String className, int classVersion, Conversion conversion)` | Creates a mutation for converting all instances of the given class version to the current version of the class.
    `Converter​(java.lang.String declaringClassName, int declaringClassVersion, java.lang.String fieldName, Conversion conversion)` | Creates a mutation for converting all values of the given field in the given class version to a type compatible with the current declared type of the field.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `boolean` | `equals​(java.lang.Object other)` | Returns true if the conversion objects are equal in this object and given object, and if the `Mutation.equals(java.lang.Object)` superclass method returns true.
    `Conversion` | `getConversion()` | Returns the converter instance specified to the constructor.
    `int` | `hashCode()` |
    `java.lang.String` | `toString()` |

    - ### Methods inherited from class com.sleepycat.persist.evolve.Mutation

      `getClassName, getClassVersion, getFieldName`

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

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

- - ### Constructor Detail

    - #### Converter

          public Converter​(java.lang.String className,
                           int classVersion,
                           Conversion conversion)

      Creates a mutation for converting all instances of the given class version to the current version of the class.
      Parameters:
        `className` - the class to which this mutation applies.
        `classVersion` - the class version to which this mutation applies.
        `conversion` - converter instance.

    - #### Converter

          public Converter​(java.lang.String declaringClassName,
                           int declaringClassVersion,
                           java.lang.String fieldName,
                           Conversion conversion)

      Creates a mutation for converting all values of the given field in the given class version to a type compatible with the current declared type of the field.
      Parameters:
        `declaringClassName` - the class to which this mutation applies.
        `declaringClassVersion` - the class version to which this mutation applies.
        `fieldName` - field name to which this mutation applies.
        `conversion` - converter instance.

  - ### Method Detail

    - #### getConversion

          public Conversion getConversion()

      Returns the converter instance specified to the constructor.
      Returns:
        the converter instance.

    - #### equals

          public boolean equals​(java.lang.Object other)

      Returns true if the conversion objects are equal in this object and given object, and if the `Mutation.equals(java.lang.Object)` superclass method returns true.
      Overrides:
        `equals` in class `Mutation`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Mutation`

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `Mutation`

Copyright (c) 1996, 2020 Oracle and/or its affiliates. All rights reserved.