diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/annotation/AfterJob.java b/spring-batch-core/src/main/java/org/springframework/batch/core/annotation/AfterJob.java new file mode 100644 index 000000000..85b98d206 --- /dev/null +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/annotation/AfterJob.java @@ -0,0 +1,27 @@ +/** + * + */ +package org.springframework.batch.core.annotation; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +import org.springframework.batch.core.Job; +import org.springframework.batch.core.JobExecution; +import org.springframework.batch.core.JobExecutionListener; + +/** + * Marks a method to be called after a {@link Job} has completed. Annotated methods + * will be called regardless of the status of the {@link JobExecution}. + * + * @author Lucas Ward + * @since 2.0 + * @see JobExecutionListener + */ +@Retention(RetentionPolicy.RUNTIME) +@Target({ElementType.METHOD}) +public @interface AfterJob { + +} diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/annotation/AfterStep.java b/spring-batch-core/src/main/java/org/springframework/batch/core/annotation/AfterStep.java new file mode 100644 index 000000000..a0e4ae9f3 --- /dev/null +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/annotation/AfterStep.java @@ -0,0 +1,27 @@ +/** + * + */ +package org.springframework.batch.core.annotation; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +import org.springframework.batch.core.Step; +import org.springframework.batch.core.StepExecution; +import org.springframework.batch.core.StepExecutionListener; + +/** + * Marks a method to be called after a {@link Step} has completed. Annotated methods + * will be called regardless of the status of the {@link StepExecution}. + * + * @author Lucas Ward + * @since 2.0 + * @see StepExecutionListener + */ +@Retention(RetentionPolicy.RUNTIME) +@Target({ElementType.METHOD}) +public @interface AfterStep { + +} diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/annotation/BeforeJob.java b/spring-batch-core/src/main/java/org/springframework/batch/core/annotation/BeforeJob.java new file mode 100644 index 000000000..ebc071adf --- /dev/null +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/annotation/BeforeJob.java @@ -0,0 +1,29 @@ +/** + * + */ +package org.springframework.batch.core.annotation; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +import org.springframework.batch.core.Job; +import org.springframework.batch.core.JobExecution; +import org.springframework.batch.core.JobExecutionListener; +import org.springframework.batch.core.Step; + +/** + * Marks a method to be called before a {@link Job} is executed, which comes + * after a {@link JobExecution} is created and persisted, but before the first + * {@link Step} is executed. + * + * @author Lucas Ward + * @since 2.0 + * @see JobExecutionListener + */ +@Retention(RetentionPolicy.RUNTIME) +@Target({ElementType.METHOD}) +public @interface BeforeJob { + +} diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/annotation/BeforeStep.java b/spring-batch-core/src/main/java/org/springframework/batch/core/annotation/BeforeStep.java new file mode 100644 index 000000000..7bcd88920 --- /dev/null +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/annotation/BeforeStep.java @@ -0,0 +1,28 @@ +/** + * + */ +package org.springframework.batch.core.annotation; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +import org.springframework.batch.core.Step; +import org.springframework.batch.core.StepExecution; +import org.springframework.batch.core.StepExecutionListener; + +/** + * Marks a method to be called before a {@link Step} is executed, which comes + * after a {@link StepExecution} is created and persisted, but before the first + * item is read. + * + * @author Lucas Ward + * @since 2.0 + * @see StepExecutionListener + */ +@Retention(RetentionPolicy.RUNTIME) +@Target({ElementType.METHOD}) +public @interface BeforeStep { + +}