java.io.Serializable
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 | 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 | 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)
fromClass
- the class to rename.fromVersion
- the class version to rename.toClass
- the new class name.public Renamer(java.lang.String declaringClass, int declaringClassVersion, java.lang.String fromField, java.lang.String toField)
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.public java.lang.String getNewName()
public boolean equals(java.lang.Object other)
Mutation.equals(java.lang.Object)
method returns true.Copyright (c) 1996, 2020 Oracle and/or its affiliates. All rights reserved.