public abstract class AbstractPrimitive extends java.lang.Object implements Primitive
Modifier and Type | Field and Description |
---|---|
protected boolean |
changesClassHierarchy |
protected ClassContent |
classContent |
protected java.lang.Class<?> |
clazz |
protected java.util.Set<ClassContent> |
modifiedClasses |
Constructor and Description |
---|
AbstractPrimitive(ClassContent classContent) |
Modifier and Type | Method and Description |
---|---|
protected java.lang.String |
changeVersion(java.lang.String content,
java.lang.Class<?> clazz,
int from,
int to)
Changes the version of the class in the source code.
|
java.util.Set<ClassContent> |
execute()
Do changes in the class and update the version number
|
protected abstract void |
executePrimitive()
Method that each primitive have to override to implement its own
funtionality.
|
protected java.lang.Class<?> |
getSuperClass(ClassContent classContent) |
java.lang.Class |
getTargetClass()
Return the class that is modified by this primitive.
|
boolean |
isSafe()
Returns if the primitive is safe or not.
|
void |
undo()
Reverts all changes
|
protected abstract void |
undoPrimitive()
Method that each primitive have to override to revert its own changes
over the ClassContent.
|
protected void |
undoUpdateVersion()
Reverts all changes done by
updateVersion |
protected void |
updateVersion()
Increases the version number and updates the cached code to a new
version.
|
protected void |
updateVersion(java.lang.Class<?> clazz,
java.lang.String superclassName)
Updates the class and subclasses provided
|
protected java.util.Set<ClassContent> modifiedClasses
protected ClassContent classContent
protected java.lang.Class<?> clazz
protected boolean changesClassHierarchy
public AbstractPrimitive(ClassContent classContent)
public java.lang.Class getTargetClass()
Primitive
getTargetClass
in interface Primitive
protected void updateVersion()
protected void updateVersion(java.lang.Class<?> clazz, java.lang.String superclassName) throws StructuralIntercessionException
clazz
- The class to evolvesuperclassName
- The new superclassStructuralIntercessionException
protected void undoUpdateVersion()
updateVersion
protected java.lang.String changeVersion(java.lang.String content, java.lang.Class<?> clazz, int from, int to)
content
- The source codeclazz
- The original classfrom
- Actual version number of the source codeto
- New version numberprotected java.lang.Class<?> getSuperClass(ClassContent classContent) throws StructuralIntercessionException
StructuralIntercessionException
public void undo() throws StructuralIntercessionException
undo
in interface Primitive
StructuralIntercessionException
public java.util.Set<ClassContent> execute() throws StructuralIntercessionException
execute
in interface Primitive
ClassContent
modified by the primitiveStructuralIntercessionException
- If there are errors while performing the modificactionsprotected abstract void executePrimitive() throws StructuralIntercessionException
StructuralIntercessionException
- If there are any errorprotected abstract void undoPrimitive() throws StructuralIntercessionException
StructuralIntercessionException
- If there are any error