Skip to content

Commit c4ad90b

Browse files
committed
Apply spring-javaformat style for consistency with other projects
Resolves #4118
1 parent b3fe088 commit c4ad90b

File tree

1,626 files changed

+44692
-45826
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,626 files changed

+44692
-45826
lines changed

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

Lines changed: 19 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,15 @@
2727
public enum BatchStatus {
2828

2929
/**
30-
* The order of the status values is significant because it can be used to
31-
* aggregate a set of status values. The result should be the maximum
32-
* value. Since {@code COMPLETED} is first in the order, only if all elements of an
33-
* execution are {@code COMPLETED} can the aggregate status be COMPLETED. A running
34-
* execution is expected to move from {@code STARTING} to {@code STARTED} to {@code COMPLETED}
35-
* (through the order defined by {@link #upgradeTo(BatchStatus)}). Higher
36-
* values than {@code STARTED} signify more serious failures. {@code ABANDONED} is used for
37-
* steps that have finished processing but were not successful and where
38-
* they should be skipped on a restart (so {@code FAILED} is the wrong status).
30+
* The order of the status values is significant because it can be used to aggregate a
31+
* set of status values. The result should be the maximum value. Since
32+
* {@code COMPLETED} is first in the order, only if all elements of an execution are
33+
* {@code COMPLETED} can the aggregate status be COMPLETED. A running execution is
34+
* expected to move from {@code STARTING} to {@code STARTED} to {@code COMPLETED}
35+
* (through the order defined by {@link #upgradeTo(BatchStatus)}). Higher values than
36+
* {@code STARTED} signify more serious failures. {@code ABANDONED} is used for steps
37+
* that have finished processing but were not successful and where they should be
38+
* skipped on a restart (so {@code FAILED} is the wrong status).
3939
*/
4040

4141
/**
@@ -72,8 +72,8 @@ public enum BatchStatus {
7272
UNKNOWN;
7373

7474
/**
75-
* Convenience method to return the higher value status of the statuses passed to the method.
76-
*
75+
* Convenience method to return the higher value status of the statuses passed to the
76+
* method.
7777
* @param status1 The first status to check.
7878
* @param status2 The second status to check.
7979
* @return The higher value status of the two statuses.
@@ -84,31 +84,27 @@ public static BatchStatus max(BatchStatus status1, BatchStatus status2) {
8484

8585
/**
8686
* Convenience method to decide if a status indicates that work is in progress.
87-
*
8887
* @return true if the status is STARTING, STARTED
8988
*/
9089
public boolean isRunning() {
9190
return this == STARTING || this == STARTED;
9291
}
9392

9493
/**
95-
* Convenience method to decide if a status indicates execution was
96-
* unsuccessful.
97-
*
94+
* Convenience method to decide if a status indicates execution was unsuccessful.
9895
* @return {@code true} if the status is {@code FAILED} or greater.
9996
*/
10097
public boolean isUnsuccessful() {
10198
return this == FAILED || this.isGreaterThan(FAILED);
10299
}
103100

104101
/**
105-
* Method used to move status values through their logical progression, and
106-
* override less severe failures with more severe ones. This value is
107-
* compared with the parameter, and the one that has higher priority is
108-
* returned. If both are {@code STARTED} or less than the value returned is the
109-
* largest in the sequence {@code STARTING}, {@code STARTED}, {@code COMPLETED}. Otherwise, the value
110-
* returned is the maximum of the two.
111-
*
102+
* Method used to move status values through their logical progression, and override
103+
* less severe failures with more severe ones. This value is compared with the
104+
* parameter, and the one that has higher priority is returned. If both are
105+
* {@code STARTED} or less than the value returned is the largest in the sequence
106+
* {@code STARTING}, {@code STARTED}, {@code COMPLETED}. Otherwise, the value returned
107+
* is the maximum of the two.
112108
* @param other Another status to which to compare.
113109
* @return either this or the other status, depending on their priority.
114110
*/
@@ -151,7 +147,6 @@ public boolean isLessThanOrEqualTo(BatchStatus other) {
151147
* Find a {@code BatchStatus} that matches the beginning of the given value. If no
152148
* match is found, return {@code COMPLETED} as the default because it has low
153149
* precedence.
154-
*
155150
* @param value A string representing a status.
156151
* @return a {BatchStatus} object.
157152
*/
@@ -164,4 +159,5 @@ public static BatchStatus match(String value) {
164159
// Default match should be the lowest priority
165160
return COMPLETED;
166161
}
162+
167163
}

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

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,8 @@
1818
import org.springframework.batch.core.scope.context.ChunkContext;
1919

2020
/**
21-
* Listener interface for the lifecycle of a chunk. A chunk
22-
* can be thought of as a collection of items that are
23-
* committed together.
21+
* Listener interface for the lifecycle of a chunk. A chunk can be thought of as a
22+
* collection of items that are committed together.
2423
*
2524
* @author Lucas Ward
2625
* @author Michael Minella
@@ -36,32 +35,30 @@ public interface ChunkListener extends StepListener {
3635

3736
/**
3837
* Callback before the chunk is executed, but inside the transaction.
39-
*
4038
* @param context The current {@link ChunkContext}
4139
*/
4240
default void beforeChunk(ChunkContext context) {
4341
}
4442

4543
/**
4644
* Callback after the chunk is executed, outside the transaction.
47-
*
4845
* @param context The current {@link ChunkContext}
4946
*/
5047
default void afterChunk(ChunkContext context) {
5148
}
5249

5350
/**
54-
* Callback after a chunk has been marked for rollback. It is invoked
55-
* after transaction rollback. While the rollback will have occurred,
56-
* transactional resources might still be active and accessible. Due to
57-
* this, data access code within this callback still "participates" in
58-
* the original transaction unless it declares that it runs in its own
59-
* transaction. <em>As a result, you should use {@code PROPAGATION_REQUIRES_NEW} for any
60-
* transactional operation that is called from here.</em>
61-
*
62-
* @param context the chunk context containing the exception that caused
63-
* the underlying rollback.
51+
* Callback after a chunk has been marked for rollback. It is invoked after
52+
* transaction rollback. While the rollback will have occurred, transactional
53+
* resources might still be active and accessible. Due to this, data access code
54+
* within this callback still "participates" in the original transaction unless it
55+
* declares that it runs in its own transaction. <em>As a result, you should use
56+
* {@code PROPAGATION_REQUIRES_NEW} for any transactional operation that is called
57+
* from here.</em>
58+
* @param context the chunk context containing the exception that caused the
59+
* underlying rollback.
6460
*/
6561
default void afterChunkError(ChunkContext context) {
6662
}
63+
6764
}

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

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@
2525
import org.springframework.util.DigestUtils;
2626

2727
/**
28-
* Default implementation of the {@link JobKeyGenerator} interface.
29-
* This implementation provides a single hash value based on the {@link JobParameters} object
30-
* passed in. Only identifying parameters (as per {@link JobParameter#isIdentifying()})
31-
* are used in the calculation of the key.
28+
* Default implementation of the {@link JobKeyGenerator} interface. This implementation
29+
* provides a single hash value based on the {@link JobParameters} object passed in. Only
30+
* identifying parameters (as per {@link JobParameter#isIdentifying()}) are used in the
31+
* calculation of the key.
3232
*
3333
* @author Michael Minella
3434
* @author Mahmoud Ben Hassine
@@ -50,16 +50,17 @@ public String generateKey(JobParameters source) {
5050
Collections.sort(keys);
5151
for (String key : keys) {
5252
JobParameter jobParameter = props.get(key);
53-
if(jobParameter.isIdentifying()) {
54-
String value = jobParameter.getValue()==null ? "" : jobParameter.toString();
53+
if (jobParameter.isIdentifying()) {
54+
String value = jobParameter.getValue() == null ? "" : jobParameter.toString();
5555
stringBuffer.append(key).append("=").append(value).append(";");
5656
}
5757
}
5858
try {
5959
return DigestUtils.md5DigestAsHex(stringBuffer.toString().getBytes("UTF-8"));
60-
} catch (UnsupportedEncodingException e) {
61-
throw new IllegalStateException(
62-
"UTF-8 encoding not available. Fatal (should be in the JDK).");
60+
}
61+
catch (UnsupportedEncodingException e) {
62+
throw new IllegalStateException("UTF-8 encoding not available. Fatal (should be in the JDK).");
6363
}
6464
}
65+
6566
}

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

Lines changed: 21 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,9 @@
2121
import org.springframework.util.ClassUtils;
2222

2323
/**
24-
* Batch Domain Entity class. Any class that should be uniquely identifiable
25-
* from another should subclass from Entity. See Domain
26-
* Driven Design, by Eric Evans, for more information on this pattern
27-
* and the difference between Entities and Value Objects.
24+
* Batch Domain Entity class. Any class that should be uniquely identifiable from another
25+
* should subclass from Entity. See Domain Driven Design, by Eric Evans, for more
26+
* information on this pattern and the difference between Entities and Value Objects.
2827
*
2928
* @author Lucas Ward
3029
* @author Dave Syer
@@ -48,15 +47,14 @@ public Entity() {
4847

4948
/**
5049
* The constructor for the {@link Entity} where the ID is established.
51-
*
5250
* @param id The ID for the entity.
5351
*/
5452
public Entity(Long id) {
5553
super();
5654

57-
//Commented out because StepExecutions are still created in a disconnected
58-
//manner. The Repository should create them, then this can be uncommented.
59-
//Assert.notNull(id, "Entity id must not be null.");
55+
// Commented out because StepExecutions are still created in a disconnected
56+
// manner. The Repository should create them, then this can be uncommented.
57+
// Assert.notNull(id, "Entity id must not be null.");
6058
this.id = id;
6159
}
6260

@@ -95,23 +93,24 @@ public void setVersion(Integer version) {
9593
public void incrementVersion() {
9694
if (version == null) {
9795
version = 0;
98-
} else {
96+
}
97+
else {
9998
version = version + 1;
10099
}
101100
}
102101

103-
/**
104-
* Creates a string representation of the {@code Entity},
105-
* including the {@code id}, {@code version}, and class name.
106-
*/
102+
/**
103+
* Creates a string representation of the {@code Entity}, including the {@code id},
104+
* {@code version}, and class name.
105+
*/
107106
@Override
108107
public String toString() {
109108
return String.format("%s: id=%d, version=%d", ClassUtils.getShortName(getClass()), id, version);
110109
}
111110

112111
/**
113-
* Attempt to establish identity based on {@code id} if both exist. If either {@code id}
114-
* does not exist, use {@code Object.equals()}.
112+
* Attempt to establish identity based on {@code id} if both exist. If either
113+
* {@code id} does not exist, use {@code Object.equals()}.
115114
*
116115
* @see java.lang.Object#equals(java.lang.Object)
117116
*/
@@ -135,14 +134,13 @@ public boolean equals(Object other) {
135134

136135
/**
137136
* Use {@code id}, if it exists, to establish a hash code. Otherwise fall back to
138-
* {@code Object.hashCode()}. It is based on the
139-
* same information as {@code equals}, so, if that
140-
* changes, this will. Note that this follows the contract of {@code Object.hashCode()}
141-
* but will cause problems for anyone adding an unsaved {@link Entity} to a
142-
* {@code Set} because {@code Set.contains()} almost certainly returns false for the
143-
* {@link Entity} after it is saved. Spring Batch does not store any of its
144-
* entities in sets as a matter of course, so this is internally consistent.
145-
* Clients should not be exposed to unsaved entities.
137+
* {@code Object.hashCode()}. It is based on the same information as {@code equals},
138+
* so, if that changes, this will. Note that this follows the contract of
139+
* {@code Object.hashCode()} but will cause problems for anyone adding an unsaved
140+
* {@link Entity} to a {@code Set} because {@code Set.contains()} almost certainly
141+
* returns false for the {@link Entity} after it is saved. Spring Batch does not store
142+
* any of its entities in sets as a matter of course, so this is internally
143+
* consistent. Clients should not be exposed to unsaved entities.
146144
*
147145
* @see java.lang.Object#hashCode()
148146
*/

0 commit comments

Comments
 (0)