public class Renamer extends Mutation
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
.
Class Evolution
,
Serialized FormConstructor 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.
|
Modifier and Type | Method and Description |
---|---|
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() |
getClassName, getClassVersion, getFieldName
public Renamer(java.lang.String fromClass, int fromVersion, java.lang.String toClass)
public Renamer(java.lang.String declaringClass, int declaringClassVersion, java.lang.String fromField, java.lang.String toField)
public java.lang.String getNewName()
public boolean equals(java.lang.Object other)
Mutation.equals(java.lang.Object)
method returns true.Copyright (c) 2004,2014 Oracle. All rights reserved.