Skip to content

Commit a7f8c84

Browse files
committed
Add default implementation to Step#getName
Resolves #4976
1 parent 4757cce commit a7f8c84

File tree

1 file changed

+9
-3
lines changed
  • spring-batch-core/src/main/java/org/springframework/batch/core/step

1 file changed

+9
-3
lines changed

spring-batch-core/src/main/java/org/springframework/batch/core/step/Step.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2006-2022 the original author or authors.
2+
* Copyright 2006-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -27,6 +27,7 @@
2727
* @author Mahmoud Ben Hassine
2828
*
2929
*/
30+
@FunctionalInterface
3031
public interface Step {
3132

3233
/**
@@ -35,9 +36,14 @@ public interface Step {
3536
String STEP_TYPE_KEY = "batch.stepType";
3637

3738
/**
38-
* @return the name of this step.
39+
* The name of the step. This is used to distinguish between different steps and must
40+
* be unique within a job. If not explicitly set, the name will default to the fully
41+
* qualified class name.
42+
* @return the name of the step (never {@code null})
3943
*/
40-
String getName();
44+
default String getName() {
45+
return this.getClass().getName();
46+
}
4147

4248
/**
4349
* @return {@code true} if a step that is already marked as complete can be started

0 commit comments

Comments
 (0)