Skip to content

Commit 668c614

Browse files
committed
Add default methods in ItemStream interface
1 parent 30cee99 commit 668c614

File tree

1 file changed

+7
-4
lines changed
  • spring-batch-infrastructure/src/main/java/org/springframework/batch/item

1 file changed

+7
-4
lines changed

spring-batch-infrastructure/src/main/java/org/springframework/batch/item/ItemStream.java

Lines changed: 7 additions & 4 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.
@@ -36,7 +36,8 @@ public interface ItemStream {
3636
* executionContext from the last run of the step on a restart.
3737
* @throws IllegalArgumentException if context is null
3838
*/
39-
void open(ExecutionContext executionContext) throws ItemStreamException;
39+
default void open(ExecutionContext executionContext) throws ItemStreamException {
40+
}
4041

4142
/**
4243
* Indicates that the execution context provided during open is about to be saved. If
@@ -45,13 +46,15 @@ public interface ItemStream {
4546
* @param executionContext to be updated
4647
* @throws IllegalArgumentException if executionContext is null.
4748
*/
48-
void update(ExecutionContext executionContext) throws ItemStreamException;
49+
default void update(ExecutionContext executionContext) throws ItemStreamException {
50+
}
4951

5052
/**
5153
* If any resources are needed for the stream to operate they need to be destroyed
5254
* here. Once this method has been called all other methods (except open) may throw an
5355
* exception.
5456
*/
55-
void close() throws ItemStreamException;
57+
default void close() throws ItemStreamException {
58+
}
5659

5760
}

0 commit comments

Comments
 (0)