Skip to content

Commit 7a64e88

Browse files
committed
Added missing docs for batch.core and batch.core.configuration packages
1 parent 75b1492 commit 7a64e88

34 files changed

+462
-45
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@
126126
<maven-compiler-plugin.version>3.8.1</maven-compiler-plugin.version>
127127
<maven-surefire-plugin.version>2.22.2</maven-surefire-plugin.version>
128128
<maven-failsafe-plugin.version>2.22.2</maven-failsafe-plugin.version>
129-
<maven-javadoc-plugin.version>3.3.1</maven-javadoc-plugin.version>
129+
<maven-javadoc-plugin.version>3.3.2</maven-javadoc-plugin.version>
130130
<maven-source-plugin.version>3.2.1</maven-source-plugin.version>
131131
<jacoco-maven-plugin.version>0.8.7</jacoco-maven-plugin.version>
132132
<flatten-maven-plugin.version>1.2.7</flatten-maven-plugin.version>

spring-batch-core/src/main/java/org/springframework/batch/core/BatchStatus.java

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2006-2021 the original author or authors.
2+
* Copyright 2006-2022 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.
@@ -37,8 +37,46 @@ public enum BatchStatus {
3737
* steps that have finished processing, but were not successful, and where
3838
* they should be skipped on a restart (so FAILED is the wrong status).
3939
*/
40-
COMPLETED, STARTING, STARTED, STOPPING, STOPPED, FAILED, ABANDONED, UNKNOWN;
4140

41+
/**
42+
* The batch job has successfully completed its execution
43+
*/
44+
COMPLETED,
45+
/**
46+
* Status of a batch job prior to execution of the job.
47+
*/
48+
STARTING,
49+
/**
50+
* Status of a batch job that is running.
51+
*/
52+
STARTED,
53+
/**
54+
* Status of batch job waiting for a step to complete before stopping the batch job.
55+
*/
56+
STOPPING,
57+
/**
58+
* Status of a batch job that has been stopped by request.
59+
*/
60+
STOPPED,
61+
/**
62+
* Status of a batch job that has failed during its execution.
63+
*/
64+
FAILED,
65+
/**
66+
* Status of a batch job that did not stop properly and can not be restarted.
67+
*/
68+
ABANDONED,
69+
/**
70+
* Status of a batch job that is in an uncertain state.
71+
*/
72+
UNKNOWN;
73+
74+
/**
75+
* Convenience method to return the higher value status of the statuses pass in to the method.
76+
* @param status1 The first status to check.
77+
* @param status2 The second status to check.
78+
* @return The higher value status of the two statuses.
79+
*/
4280
public static BatchStatus max(BatchStatus status1, BatchStatus status2) {
4381
return status1.isGreaterThan(status2) ? status1 : status2;
4482
}

spring-batch-core/src/main/java/org/springframework/batch/core/ChunkListener.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2006-2021 the original author or authors.
2+
* Copyright 2006-2022 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.
@@ -29,7 +29,10 @@
2929
*/
3030
public interface ChunkListener extends StepListener {
3131

32-
static final String ROLLBACK_EXCEPTION_KEY = "sb_rollback_exception";
32+
/**
33+
* The key for retrieving the rollback exception.
34+
*/
35+
String ROLLBACK_EXCEPTION_KEY = "sb_rollback_exception";
3336

3437
/**
3538
* Callback before the chunk is executed, but inside the transaction.

spring-batch-core/src/main/java/org/springframework/batch/core/Entity.java

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2006-2013 the original author or authors.
2+
* Copyright 2006-2022 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.
@@ -37,10 +37,18 @@ public class Entity implements Serializable {
3737

3838
private volatile Integer version;
3939

40+
/**
41+
* Default constructor for {@link Entity}.
42+
* The ID defaults to zero.
43+
*/
4044
public Entity() {
4145
super();
4246
}
4347

48+
/**
49+
* The constructor for the {@link Entity} where the id is established.
50+
* @param id The ID for the entity.
51+
*/
4452
public Entity(Long id) {
4553
super();
4654

@@ -50,10 +58,16 @@ public Entity(Long id) {
5058
this.id = id;
5159
}
5260

61+
/**
62+
* @return The ID associated with the {@link Entity}.
63+
*/
5364
public Long getId() {
5465
return id;
5566
}
5667

68+
/**
69+
* @param id The ID for the {@link Entity}.
70+
*/
5771
public void setId(Long id) {
5872
this.id = id;
5973
}

spring-batch-core/src/main/java/org/springframework/batch/core/ExitStatus.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2006-2021 the original author or authors.
2+
* Copyright 2006-2022 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.
@@ -74,10 +74,21 @@ public class ExitStatus implements Serializable, Comparable<ExitStatus> {
7474

7575
private final String exitDescription;
7676

77+
/**
78+
* Constructor that accepts the exitCode and sets the exitDescription to an empty {@link String}.
79+
*
80+
* @param exitCode The exit code to be used for the {@link ExitStatus}.
81+
*/
7782
public ExitStatus(String exitCode) {
7883
this(exitCode, "");
7984
}
8085

86+
/**
87+
* Constructor that establishes the exitCode and the exitDescription for the {@link ExitStatus}.
88+
*
89+
* @param exitCode The exit code to be used for the {@link ExitStatus}.
90+
* @param exitDescription The exit description to be used for the {@link ExitStatus}.
91+
*/
8192
public ExitStatus(String exitCode, String exitDescription) {
8293
super();
8394
this.exitCode = exitCode;

spring-batch-core/src/main/java/org/springframework/batch/core/JobExecution.java

Lines changed: 44 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2006-2021 the original author or authors.
2+
* Copyright 2006-2022 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.
@@ -65,6 +65,10 @@ public class JobExecution extends Entity {
6565

6666
private transient volatile List<Throwable> failureExceptions = new CopyOnWriteArrayList<>();
6767

68+
/**
69+
* Constructor that sets the state of the instance to the {@link JobExecution} parameter.
70+
* @param original The {@link JobExecution} to be copied.
71+
*/
6872
public JobExecution(JobExecution original) {
6973
this.jobParameters = original.getJobParameters();
7074
this.jobInstance = original.getJobInstance();
@@ -98,45 +102,78 @@ public JobExecution(JobInstance job, Long id, @Nullable JobParameters jobParamet
98102
/**
99103
* Constructor for transient (unsaved) instances.
100104
*
101-
* @param job the enclosing {@link JobInstance}
102-
* @param jobParameters {@link JobParameters} instance for this JobExecution.
105+
* @param job The enclosing {@link JobInstance}
106+
* @param jobParameters The {@link JobParameters} instance for this JobExecution.
103107
*/
104108
public JobExecution(JobInstance job, JobParameters jobParameters) {
105109
this(job, null, jobParameters);
106110
}
107111

112+
/**
113+
* Constructor that accepts the current job execution ID and {@link JobParameters}.
114+
* @param id The job execution ID.
115+
* @param jobParameters The {@link JobParameters} for the {@link JobExecution}.
116+
*/
108117
public JobExecution(Long id, JobParameters jobParameters) {
109118
this(null, id, jobParameters);
110119
}
111120

121+
/**
122+
* Constructor that accepts the current job execution ID.
123+
* @param id The job execution ID.
124+
*/
112125
public JobExecution(Long id) {
113126
this(null, id, null);
114127
}
115128

129+
/**
130+
* @return The current {@link JobParameters}.
131+
*/
116132
public JobParameters getJobParameters() {
117133
return this.jobParameters;
118134
}
119135

136+
/**
137+
* @return The current end time.
138+
*/
120139
public Date getEndTime() {
121140
return endTime;
122141
}
123142

143+
/**
144+
* Set the {@link JobInstance} used by the {@link JobExecution}.
145+
* @param jobInstance The {@link JobInstance} used by the {@link JobExecution}.
146+
*/
124147
public void setJobInstance(JobInstance jobInstance) {
125148
this.jobInstance = jobInstance;
126149
}
127150

151+
/**
152+
* Set the end time.
153+
* @param endTime The {@link Date} to be used for the end time.
154+
*/
128155
public void setEndTime(Date endTime) {
129156
this.endTime = endTime;
130157
}
131158

159+
/**
160+
* @return The current start time.
161+
*/
132162
public Date getStartTime() {
133163
return startTime;
134164
}
135165

166+
/**
167+
* Set the start time.
168+
* @param startTime The {@link Date} to be used for the start time.
169+
*/
136170
public void setStartTime(Date startTime) {
137171
this.startTime = startTime;
138172
}
139173

174+
/**
175+
* @return The current {@link BatchStatus}.
176+
*/
140177
public BatchStatus getStatus() {
141178
return status;
142179
}
@@ -297,6 +334,10 @@ public void setLastUpdated(Date lastUpdated) {
297334
this.lastUpdated = lastUpdated;
298335
}
299336

337+
/**
338+
* Retrieve a list of exceptions.
339+
* @return The {@link List} of {@link Throwable}s.
340+
*/
300341
public List<Throwable> getFailureExceptions() {
301342
return failureExceptions;
302343
}

spring-batch-core/src/main/java/org/springframework/batch/core/JobInstance.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2006-2021 the original author or authors.
2+
* Copyright 2006-2022 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.
@@ -43,6 +43,11 @@ public class JobInstance extends Entity {
4343

4444
private final String jobName;
4545

46+
/**
47+
* Constructor for {@link JobInstance}.
48+
* @param id The instance ID.
49+
* @param jobName The name associated with the {@link JobInstance}.
50+
*/
4651
public JobInstance(Long id, String jobName) {
4752
super(id);
4853
Assert.hasLength(jobName, "A jobName is required");
@@ -61,6 +66,9 @@ public String toString() {
6166
return super.toString() + ", Job=[" + jobName + "]";
6267
}
6368

69+
/**
70+
* @return The current instance ID.
71+
*/
6472
public long getInstanceId() {
6573
return super.getId();
6674
}

spring-batch-core/src/main/java/org/springframework/batch/core/JobInterruptedException.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2006-2021 the original author or authors.
2+
* Copyright 2006-2022 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.
@@ -33,10 +33,19 @@ public class JobInterruptedException extends JobExecutionException {
3333

3434
private BatchStatus status = BatchStatus.STOPPED;
3535

36+
/**
37+
* Constructor that sets the message for the exception.
38+
* @param msg The message for the exception.
39+
*/
3640
public JobInterruptedException(String msg) {
3741
super(msg);
3842
}
3943

44+
/**
45+
* Constructor that sets the message for the exception.
46+
* @param msg The message for the exception.
47+
* @param status The desired {@link BatchStatus} of the surrounding execution after interruption.
48+
*/
4049
public JobInterruptedException(String msg, BatchStatus status) {
4150
super(msg);
4251
this.status = status;

spring-batch-core/src/main/java/org/springframework/batch/core/JobParameter.java

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2006-2021 the original author or authors.
2+
* Copyright 2006-2022 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.
@@ -125,6 +125,9 @@ public JobParameter(Double parameter) {
125125
this(parameter, true);
126126
}
127127

128+
/**
129+
* @return The identifying flag. It is set to true if the job parameter is identifying.
130+
*/
128131
public boolean isIdentifying() {
129132
return identifying;
130133
}
@@ -168,10 +171,25 @@ public int hashCode() {
168171
}
169172

170173
/**
171-
* Enumeration representing the type of a JobParameter.
174+
* Enumeration representing the type of {@link JobParameter}.
172175
*/
173176
public enum ParameterType {
174177

175-
STRING, DATE, LONG, DOUBLE;
178+
/**
179+
* String parameter type.
180+
*/
181+
STRING,
182+
/**
183+
* Date parameter type.
184+
*/
185+
DATE,
186+
/**
187+
* Long parameter type.
188+
*/
189+
LONG,
190+
/**
191+
* Double parameter type.
192+
*/
193+
DOUBLE;
176194
}
177195
}

0 commit comments

Comments
 (0)