15
15
*/
16
16
package org .springframework .batch .core ;
17
17
18
+ import org .springframework .batch .core .job .DefaultJobParametersValidator ;
18
19
import org .springframework .lang .Nullable ;
19
20
20
21
/**
@@ -33,9 +34,11 @@ public interface Job {
33
34
/**
34
35
* Flag to indicate if this job can be restarted, at least in principle.
35
36
*
36
- * @return true if this job can be restarted after a failure
37
+ * @return true if this job can be restarted after a failure. Defaults to {@code true}.
37
38
*/
38
- boolean isRestartable ();
39
+ default boolean isRestartable () {
40
+ return true ;
41
+ }
39
42
40
43
/**
41
44
* Run the {@link JobExecution} and update the meta information, such as status
@@ -52,19 +55,23 @@ public interface Job {
52
55
* sequence, they can use this incrementer. The return value may be {@code null},
53
56
* when this job does not have a natural sequence.
54
57
*
55
- * @return in incrementer to be used for creating new parameters
58
+ * @return an incrementer to be used for creating new parameters. Defaults to {@code null}.
56
59
*/
57
60
@ Nullable
58
- JobParametersIncrementer getJobParametersIncrementer ();
61
+ default JobParametersIncrementer getJobParametersIncrementer () {
62
+ return null ;
63
+ }
59
64
60
65
/**
61
66
* A validator for the job parameters of a {@link JobExecution}. Clients of
62
67
* a {@code Job} may need to validate the parameters for a launch or before or during
63
68
* the execution.
64
69
*
65
70
* @return a validator that can be used to check parameter values (never
66
- * {@code null}).
71
+ * {@code null}). Defaults to {@link DefaultJobParametersValidator}.
67
72
*/
68
- JobParametersValidator getJobParametersValidator ();
73
+ default JobParametersValidator getJobParametersValidator () {
74
+ return new DefaultJobParametersValidator ();
75
+ }
69
76
70
77
}
0 commit comments