com.sleepycat.persist.evolve

## Class Renamer

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

All Implemented Interfaces:
  java.io.Serializable

    public class Renamer
    extends Mutation

A mutation for renaming a class or field without changing the instance or field value. For example:

      package my.package;

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

      // The new class.  A new version number must be assigned.
      //
      @Entity(version=1)
      class Human {
          String fullName;
      }

      // Add the mutations.
      //
      Mutations mutations = new Mutations();

      mutations.addRenamer(new Renamer("my.package.Person", 0,
                                       Human.class.getName()));

      mutations.addRenamer(new Renamer("my.package.Person", 0,
                                       "name", "fullName"));

      // Configure the mutations as described here.

See Also:
  `Class Evolution`, Serialized Form

### Constructor Summary

Constructors
Constructor and Description
`Renamer(java.lang.String fromClass, int fromVersion, java.lang.String toClass)` Creates a mutation for renaming the class of all instances of the given class version.
`Renamer(java.lang.String declaringClass, int declaringClassVersion, java.lang.String fromField, java.lang.String toField)` Creates a mutation for renaming the given field for all instances of the given class version.

### Method Summary

All Methods Instance Methods Concrete Methods
`boolean` `equals(java.lang.Object other)` Returns true if the new class name is equal in this object and given object, and if the `Mutation.equals(java.lang.Object)` method returns true.
`java.lang.String` `getNewName()` Returns the new class or field name specified in 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

#### Renamer

    public Renamer(java.lang.String fromClass,
                   int fromVersion,
                   java.lang.String toClass)

Creates a mutation for renaming the class of all instances of the given class version.

Parameters:
  `fromClass` - the class to rename.
  `fromVersion` - the class version to rename.
  `toClass` - the new class name.

#### Renamer

    public Renamer(java.lang.String declaringClass,
                   int declaringClassVersion,
                   java.lang.String fromField,
                   java.lang.String toField)

Creates a mutation for renaming the given field for all instances of the given class version.

Parameters:
  `declaringClass` - the class to which this mutation applies.
  `declaringClassVersion` - the class version to which this mutation applies.
  `fromField` - field name in the given class version.
  `toField` - the new field name.

### Method Detail

#### getNewName

    public java.lang.String getNewName()

Returns the new class or field name specified in the constructor.

Returns:
  the new name.

#### equals

    public boolean equals(java.lang.Object other)

Returns true if the new class name is equal in this object and given object, and if the `Mutation.equals(java.lang.Object)` 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`