public class Intercessor
extends java.lang.Object
| Constructor and Description |
|---|
Intercessor(java.lang.String[] projectPaths,
java.lang.String[] solutionPaths)
Creates the intercessor that modifies the classes contained in the specified paths.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addClass(java.lang.String fileName,
int modifiers,
java.lang.String className)
Creates a new class into the specified file.
|
void |
addConstructor(java.lang.Class<?> clazz,
int modifiers,
java.lang.reflect.Parameter... parameters)
Adds a constructor into the class.
|
void |
addField(java.lang.Class<?> clazz,
int modifiers,
java.lang.Class<?> fieldClass,
java.lang.String fieldName)
Adds the field into the class.
|
void |
addField(java.lang.Class<?> clazz,
int modifiers,
java.lang.reflect.Type fieldType,
java.lang.String fieldName)
Adds the field into the class.
|
void |
addFile(java.lang.String fileName)
Creates a new file into the project.
|
void |
addFile(java.lang.String projectPath,
java.lang.String fileName)
Creates a new file into the specified path of the project.
|
void |
addGenericTypeParameter(java.lang.Class<?> clazz,
java.lang.String genericType)
Adds a new generic type parameter to the class.
|
void |
addImplement(java.lang.Class<?> clazz,
java.lang.Class<?> interfaze)
Adds the interface into the interfaces implemented by the class.
|
void |
addInterface(java.lang.String fileName,
int modifiers,
java.lang.String interfaceName)
Creates a new interface into the specified file.
|
void |
addMethod(java.lang.Class<?> clazz,
int modifiers,
java.lang.Class<?> methodClass,
java.lang.String methodName,
java.lang.reflect.Parameter... parameters)
Adds a method into the class.
|
void |
addMethod(java.lang.Class<?> clazz,
int modifiers,
java.lang.reflect.Type methodType,
java.lang.String methodName,
java.lang.reflect.Parameter... parameters)
Adds a method into the class.
|
void |
addModifier(java.lang.Class<?> clazz,
int modifier)
Adds a modifier to the class.
|
void |
addModifier(java.lang.reflect.Constructor<?> constructor,
int modifier)
Adds a modifier to the constructor.
|
void |
addModifier(java.lang.reflect.Field field,
int modifier)
Adds a modifier to the field.
|
void |
addModifier(java.lang.reflect.Method method,
int modifier)
Adds a modifier to the method.
|
void |
closeFile(java.lang.String fileName)
Closes the file saving the changes applied.
|
void |
copyConstructor(java.lang.Class<?> clazz,
java.lang.Class<?>... paramClasses)
Copies a constructor from the equivalent class of the solution.
|
void |
copyConstructor(java.lang.reflect.Constructor<?> constructor)
Copies a constructor from the equivalent class of the solution.
|
void |
copyConstructors(java.lang.Class<?> clazz)
Copies the constructors from the equivalent class of the solution.
|
void |
copyField(java.lang.Class<?> clazz,
java.lang.String fieldName)
Copies a field from the equivalent class of the solution.
|
void |
copyField(java.lang.reflect.Field field)
Copies a field from the equivalent class of the solution.
|
void |
copyFields(java.lang.Class<?> clazz)
Copies the fields from the equivalent class of the solution.
|
void |
copyFile(java.lang.String fileName)
Copies the file from the solution into the project.
|
void |
copyFile(java.lang.String projectPath,
java.lang.String fileName)
Copies the file from the solution into the specified path of the project.
|
void |
copyMethod(java.lang.Class<?> clazz,
java.lang.String methodName,
java.lang.Class<?>... paramClasses)
Copies a method from the equivalent class of the solution.
|
void |
copyMethod(java.lang.reflect.Method method)
Copies a method from the equivalent class of the solution.
|
void |
copyMethods(java.lang.Class<?> clazz)
Copies the methods from the equivalent class of the solution.
|
void |
openFile(java.lang.String fileName)
Loads the file into the library.
|
void |
removeConstructors(java.lang.Class<?> clazz)
Removes all the constructors of the class.
|
void |
removeFields(java.lang.Class<?> clazz)
Removes all the fields of the class.
|
void |
removeGenericTypeParameters(java.lang.Class<?> clazz)
Removes all the generic type parameters of the class.
|
void |
removeMethods(java.lang.Class<?> clazz)
Removes all the methods of the class.
|
void |
setName(java.lang.Class<?> clazz,
java.lang.String newName)
Sets the name of the class.
|
void |
setName(java.lang.reflect.Field field,
java.lang.String newName)
Sets the name of the field.
|
void |
setName(java.lang.reflect.Method method,
java.lang.String newName)
Sets the name of the method.
|
void |
setName(java.lang.reflect.Parameter parameter,
java.lang.String newName)
Sets the name of the parameter.
|
void |
setSuperclass(java.lang.Class<?> clazz,
java.lang.Class<?> superClass)
Sets the superclass of the class.
|
void |
setType(java.lang.reflect.Field field,
java.lang.reflect.Type type)
Sets the type of the field.
|
void |
setType(java.lang.reflect.Method method,
java.lang.reflect.Type type)
Sets the type of the method.
|
void |
setType(java.lang.reflect.Parameter parameter,
java.lang.reflect.Type type)
Sets the type of the parameter.
|
public Intercessor(java.lang.String[] projectPaths,
java.lang.String[] solutionPaths)
projectPaths - the paths in which the classes are locatedsolutionPaths - the paths in which the code used to modify the classes are locatedpublic void openFile(java.lang.String fileName)
fileName - the name of the file to be openedpublic void closeFile(java.lang.String fileName)
fileName - the name of the file to be closedpublic void addFile(java.lang.String fileName)
fileName - the name of the file to be createdpublic void addFile(java.lang.String projectPath,
java.lang.String fileName)
projectPath - the path where the file must be createdfileName - the name of the file to be createdpublic void addClass(java.lang.String fileName,
int modifiers,
java.lang.String className)
fileName - the name of the file in which the class is going to be addedmodifiers - the modifiers of the new classclassName - the name of the class to be addedpublic void addInterface(java.lang.String fileName,
int modifiers,
java.lang.String interfaceName)
fileName - the name of the file in which the interface is going to be addedmodifiers - the modifiers of the new interfaceinterfaceName - the name of the interface to be addedpublic void addGenericTypeParameter(java.lang.Class<?> clazz,
java.lang.String genericType)
clazz - the class whose generic type parameters are going to be updatedgenericType - the generic type to be added to the classpublic void addImplement(java.lang.Class<?> clazz,
java.lang.Class<?> interfaze)
clazz - the class whose list of implemented interfaces is going to be modifiedinterfaze - the interface to be addedpublic void addField(java.lang.Class<?> clazz,
int modifiers,
java.lang.reflect.Type fieldType,
java.lang.String fieldName)
clazz - the class where the field is going to be insertedmodifiers - the modifiers of the fieldfieldType - the type of the fieldfieldName - the name of the fieldpublic void addField(java.lang.Class<?> clazz,
int modifiers,
java.lang.Class<?> fieldClass,
java.lang.String fieldName)
clazz - the class where the field is going to be insertedmodifiers - the modifiers of the fieldfieldClass - the class of the fieldfieldName - the name of the fieldpublic void addConstructor(java.lang.Class<?> clazz,
int modifiers,
java.lang.reflect.Parameter... parameters)
clazz - the class where the constructor is going to be insertedmodifiers - the modifiers of the constructorparameters - the parameters of the constructorpublic void addMethod(java.lang.Class<?> clazz,
int modifiers,
java.lang.reflect.Type methodType,
java.lang.String methodName,
java.lang.reflect.Parameter... parameters)
clazz - the class where the method is going to be insertedmodifiers - the modifiers of the methodmethodType - the type of the methodmethodName - the name of the methodparameters - the parameters of the methodpublic void addMethod(java.lang.Class<?> clazz,
int modifiers,
java.lang.Class<?> methodClass,
java.lang.String methodName,
java.lang.reflect.Parameter... parameters)
clazz - the class where the method is going to be insertedmodifiers - the modifiers of the methodmethodClass - the class of the methodmethodName - the name of the methodparameters - the parameters of the methodpublic void addModifier(java.lang.Class<?> clazz,
int modifier)
clazz - the class whose modifiers are going to be changedmodifier - the modifier to be added to the classpublic void addModifier(java.lang.reflect.Field field,
int modifier)
field - the field whose modifiers are going to be changedmodifier - the modifier to be added to the fieldpublic void addModifier(java.lang.reflect.Constructor<?> constructor,
int modifier)
constructor - the constructor whose modifiers are going to be changedmodifier - the modifier to be added to the constructorpublic void addModifier(java.lang.reflect.Method method,
int modifier)
method - the method whose modifiers are going to be changedmodifier - the modifier to be added to the methodpublic void removeGenericTypeParameters(java.lang.Class<?> clazz)
clazz - the class whose generic type parameters are going to be removedpublic void removeFields(java.lang.Class<?> clazz)
clazz - the class whose fields are going to be removedpublic void removeConstructors(java.lang.Class<?> clazz)
clazz - the class whose constructors are going to be removedpublic void removeMethods(java.lang.Class<?> clazz)
clazz - the class whose methods are going to be removedpublic void setSuperclass(java.lang.Class<?> clazz,
java.lang.Class<?> superClass)
clazz - the class whose superclass is going to be setsuperClass - the superclass to be set to the classpublic void setType(java.lang.reflect.Field field,
java.lang.reflect.Type type)
field - the field whose type is going to be settype - the type to be set to the fieldpublic void setType(java.lang.reflect.Method method,
java.lang.reflect.Type type)
method - the method whose type is going to be settype - the type to be set to the methodpublic void setType(java.lang.reflect.Parameter parameter,
java.lang.reflect.Type type)
parameter - the parameter whose type is going to be settype - the type to be set to the parameterpublic void setName(java.lang.Class<?> clazz,
java.lang.String newName)
clazz - the class whose name is going to be setnewName - the name to be set to the classpublic void setName(java.lang.reflect.Field field,
java.lang.String newName)
field - the field whose name is going to be setnewName - the name to be set to the fieldpublic void setName(java.lang.reflect.Method method,
java.lang.String newName)
method - the method whose name is going to be setnewName - the name to be set to the methodpublic void setName(java.lang.reflect.Parameter parameter,
java.lang.String newName)
parameter - the parameter whose name is going to be setnewName - the name to be set to the parameterpublic void copyFile(java.lang.String fileName)
fileName - the file to be copiedpublic void copyFile(java.lang.String projectPath,
java.lang.String fileName)
projectPath - the path where the file must be createdfileName - the file to be copiedpublic void copyFields(java.lang.Class<?> clazz)
clazz - the class to be modifiedpublic void copyField(java.lang.reflect.Field field)
field - the field to be modifiedpublic void copyField(java.lang.Class<?> clazz,
java.lang.String fieldName)
clazz - the class where the field is locatedfieldName - the name of the field to be copiedpublic void copyConstructors(java.lang.Class<?> clazz)
clazz - the class to be modifiedpublic void copyConstructor(java.lang.reflect.Constructor<?> constructor)
constructor - the constructor to be modifiedpublic void copyConstructor(java.lang.Class<?> clazz,
java.lang.Class<?>... paramClasses)
clazz - the class where the constructor is locatedparamClasses - the classes of the parameters of the constructor to be copiedpublic void copyMethods(java.lang.Class<?> clazz)
clazz - the class to be modifiedpublic void copyMethod(java.lang.reflect.Method method)
method - the method to be modifiedpublic void copyMethod(java.lang.Class<?> clazz,
java.lang.String methodName,
java.lang.Class<?>... paramClasses)
clazz - the class where the method is locatedmethodName - the name of the method to be copiedparamClasses - the classes of the parameters of the method to be copied