public abstract class AbstractReflectionLoadedTask extends AbstractLoadedTask
This class serves as the foundation for both code-based and template-based changes, providing common reflection-based execution capabilities. It handles the distinction between the source file (where the change is defined) and the implementation class (where the logic resides).
@Change annotationThis class uses reflection to:
@Apply)@Rollback)Concrete implementations must provide:
getConstructor() - Constructor for instantiating the changegetApplyMethod() - Method to execute the changegetRollbackMethod() - Optional method for rollback operationsAbstractLoadedTask| Modifier and Type | Field and Description |
|---|---|
protected java.lang.String |
fileName
The source file name where this change is defined.
|
protected java.lang.Class<?> |
implementationClass
The Java class that contains the actual change execution logic.
|
| Constructor and Description |
|---|
AbstractReflectionLoadedTask(java.lang.String fileName,
java.lang.String id,
java.lang.String order,
java.lang.String author,
java.lang.Class<?> implementationClass,
boolean runAlways,
boolean transactional,
boolean system,
io.flamingock.internal.common.core.task.TargetSystemDescriptor targetSystem,
io.flamingock.internal.common.core.task.RecoveryDescriptor recovery,
boolean legacy) |
| Modifier and Type | Method and Description |
|---|---|
abstract java.lang.reflect.Method |
getApplyMethod()
Returns the method to be invoked for executing the change.
|
abstract java.lang.reflect.Constructor<?> |
getConstructor()
Returns the constructor to be used for instantiating the change class.
|
java.lang.String |
getFileName()
Returns the source file name where this change is defined.
|
java.lang.Class<?> |
getImplementationClass()
Returns the Java class containing the change execution logic.
|
abstract java.util.Optional<java.lang.reflect.Method> |
getRollbackMethod()
Returns the optional method to be invoked for rolling back the change.
|
equals, getAuthor, getId, getOrder, getRecovery, getSource, getTargetSystem, hashCode, isLegacy, isRunAlways, isSystem, isTransactional, setAuthor, setId, setLegacy, setOrder, setRecovery, setRunAlways, setSource, setSystem, setTargetSystem, setTransactional, toStringclone, finalize, getClass, notify, notifyAll, wait, wait, waitprotected final java.lang.String fileName
This represents the original source of the change definition:
@Change annotationNote: This may differ from the implementationClass in template-based scenarios
where the template references a separate implementation class.
protected final java.lang.Class<?> implementationClass
This class is used for reflection-based instantiation and method invocation:
ChangeTemplate interface,
referenced by the template filefileName,
containing @Change annotationThis class must have:
getConstructor()getApplyMethod()getRollbackMethod()public AbstractReflectionLoadedTask(java.lang.String fileName,
java.lang.String id,
java.lang.String order,
java.lang.String author,
java.lang.Class<?> implementationClass,
boolean runAlways,
boolean transactional,
boolean system,
io.flamingock.internal.common.core.task.TargetSystemDescriptor targetSystem,
io.flamingock.internal.common.core.task.RecoveryDescriptor recovery,
boolean legacy)
public java.lang.String getFileName()
fileNamepublic java.lang.Class<?> getImplementationClass()
implementationClasspublic abstract java.lang.reflect.Constructor<?> getConstructor()
The constructor should be accessible and may require dependency injection parameters based on the change's requirements.
getConstructor in class AbstractLoadedTaskpublic abstract java.lang.reflect.Method getApplyMethod()
This method typically:
@ApplygetApplyMethod in class AbstractLoadedTaskpublic abstract java.util.Optional<java.lang.reflect.Method> getRollbackMethod()
This method, if present:
@RollbackgetRollbackMethod in class AbstractLoadedTaskOptional containing the rollback method, or empty if no rollback is defined