com.sleepycat.persist.evolve
Class Conversion

java.lang.Object
  extended by com.sleepycat.persist.evolve.Mutation
      extended by com.sleepycat.persist.evolve.Conversion
All Implemented Interfaces:
java.io.Serializable

public class Conversion
extends Mutation

A mutation for converting an old version of an object value to conform to the current class 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 conversion mutation.
  //
  Mutations mutations = new Mutations();

  mutations.addConversion(new Conversion(Person.class.getName(), 0,
                                         new MyConverter()));

  // Configure the mutations as described here.

See Converter for more information.

Author:
Mark Hayes
See Also:
Serialized Form

Constructor Summary
Conversion(java.lang.String className, int classVersion, Converter converter)
          Creates a mutation for converting all instances of the given class version.
Conversion(java.lang.String declaringClassName, int declaringClassVersion, java.lang.String fieldName, Converter converter)
          Creates a mutation for converting all values of the given field in the given class version.
 
Method Summary
 Converter getConverter()
          Returns the converter instance specified in the constructor.
 
Methods inherited from class com.sleepycat.persist.evolve.Mutation
getClassName, getClassVersion, getFieldName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Conversion

public Conversion(java.lang.String className,
                  int classVersion,
                  Converter converter)
Creates a mutation for converting all instances of the given class version.


Conversion

public Conversion(java.lang.String declaringClassName,
                  int declaringClassVersion,
                  java.lang.String fieldName,
                  Converter converter)
Creates a mutation for converting all values of the given field in the given class version.

Method Detail

getConverter

public Converter getConverter()
Returns the converter instance specified in the constructor.



Copyright 2004-2006 Sleepycat, Inc. All Rights Reserved.