From 96a0fc825ed9cb0c037f1c15748553b687f401b7 Mon Sep 17 00:00:00 2001 From: Mahmoud Ben Hassine Date: Tue, 17 Jul 2018 11:02:44 +0200 Subject: [PATCH] Add JSR-305 annotations to public APIs (Partially) Resolves BATCH-2688 --- .../batch/item/ExecutionContext.java | 16 +++++++++--- .../batch/item/ItemProcessor.java | 8 ++++-- .../batch/item/ItemReader.java | 9 +++++-- .../batch/item/PeekableItemReader.java | 8 ++++-- .../batch/item/adapter/package-info.java | 5 +++- .../batch/item/amqp/builder/package-info.java | 26 +++++++++++++++++++ .../batch/item/amqp/package-info.java | 6 ++++- .../batch/item/data/builder/package-info.java | 25 ++++++++++++++++++ .../batch/item/data/package-info.java | 6 ++++- .../database/AbstractCursorItemReader.java | 5 +++- .../item/database/builder/package-info.java | 25 ++++++++++++++++++ .../batch/item/database/orm/package-info.java | 6 ++++- .../batch/item/database/package-info.java | 5 +++- .../item/database/support/package-info.java | 6 ++++- .../item/file/MultiResourceItemReader.java | 10 ++++++- .../batch/item/file/ResourcesItemReader.java | 7 +++-- .../batch/item/file/builder/package-info.java | 25 ++++++++++++++++++ .../batch/item/file/mapping/package-info.java | 5 +++- .../batch/item/file/package-info.java | 5 +++- .../item/file/separator/package-info.java | 5 +++- .../item/file/transform/package-info.java | 5 +++- .../batch/item/function/package-info.java | 25 ++++++++++++++++++ .../jms/JmsMethodInvocationRecoverer.java | 8 ++++-- .../batch/item/jms/builder/package-info.java | 25 ++++++++++++++++++ .../batch/item/jms/package-info.java | 6 ++++- .../batch/item/json/JsonObjectReader.java | 4 ++- .../batch/item/json/builder/package-info.java | 25 ++++++++++++++++++ .../batch/item/json/package-info.java | 3 +++ .../batch/item/ldif/RecordMapper.java | 10 ++++--- .../batch/item/ldif/builder/package-info.java | 25 ++++++++++++++++++ .../batch/item/ldif/package-info.java | 6 ++++- .../batch/item/mail/builder/package-info.java | 25 ++++++++++++++++++ .../item/mail/javamail/package-info.java | 25 ++++++++++++++++++ .../batch/item/mail/package-info.java | 6 ++++- .../batch/item/package-info.java | 5 +++- ...tractItemCountingItemStreamItemReader.java | 7 +++-- .../item/support/builder/package-info.java | 25 ++++++++++++++++++ .../batch/item/support/package-info.java | 5 +++- .../batch/item/util/package-info.java | 25 ++++++++++++++++++ .../batch/item/validator/package-info.java | 5 +++- .../batch/item/xml/builder/package-info.java | 25 ++++++++++++++++++ .../batch/item/xml/package-info.java | 5 +++- .../batch/item/xml/stax/package-info.java | 25 ++++++++++++++++++ .../batch/jsr/item/package-info.java | 6 ++++- .../batch/jsr/repeat/package-info.java | 25 ++++++++++++++++++ .../springframework/batch/package-info.java | 5 +++- .../batch/poller/package-info.java | 25 ++++++++++++++++++ .../batch/repeat/callback/package-info.java | 5 +++- .../batch/repeat/context/package-info.java | 5 +++- .../batch/repeat/exception/package-info.java | 5 +++- .../repeat/interceptor/package-info.java | 5 +++- .../batch/repeat/listener/package-info.java | 5 +++- .../batch/repeat/package-info.java | 5 +++- .../batch/repeat/policy/package-info.java | 5 +++- .../batch/repeat/support/package-info.java | 5 +++- .../batch/support/MethodInvoker.java | 6 ++++- .../batch/support/MethodResolver.java | 7 ++++- .../batch/support/package-info.java | 5 +++- .../support/transaction/package-info.java | 5 +++- 59 files changed, 609 insertions(+), 53 deletions(-) create mode 100644 spring-batch-infrastructure/src/main/java/org/springframework/batch/item/amqp/builder/package-info.java create mode 100644 spring-batch-infrastructure/src/main/java/org/springframework/batch/item/data/builder/package-info.java create mode 100644 spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/builder/package-info.java create mode 100644 spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/builder/package-info.java create mode 100644 spring-batch-infrastructure/src/main/java/org/springframework/batch/item/function/package-info.java create mode 100644 spring-batch-infrastructure/src/main/java/org/springframework/batch/item/jms/builder/package-info.java create mode 100644 spring-batch-infrastructure/src/main/java/org/springframework/batch/item/json/builder/package-info.java create mode 100644 spring-batch-infrastructure/src/main/java/org/springframework/batch/item/ldif/builder/package-info.java create mode 100644 spring-batch-infrastructure/src/main/java/org/springframework/batch/item/mail/builder/package-info.java create mode 100644 spring-batch-infrastructure/src/main/java/org/springframework/batch/item/mail/javamail/package-info.java create mode 100644 spring-batch-infrastructure/src/main/java/org/springframework/batch/item/support/builder/package-info.java create mode 100644 spring-batch-infrastructure/src/main/java/org/springframework/batch/item/util/package-info.java create mode 100644 spring-batch-infrastructure/src/main/java/org/springframework/batch/item/xml/builder/package-info.java create mode 100644 spring-batch-infrastructure/src/main/java/org/springframework/batch/item/xml/stax/package-info.java create mode 100644 spring-batch-infrastructure/src/main/java/org/springframework/batch/jsr/repeat/package-info.java create mode 100644 spring-batch-infrastructure/src/main/java/org/springframework/batch/poller/package-info.java diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/ExecutionContext.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/ExecutionContext.java index c190826d3..9da0e0175 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/ExecutionContext.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/ExecutionContext.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2013 the original author or authors. + * Copyright 2006-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,6 +22,8 @@ import java.util.Map.Entry; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; +import org.springframework.lang.Nullable; + /** * Object representing a context for an {@link ItemStream}. It is a thin wrapper * for a map that allows optionally for type safety on reads. It also allows for @@ -32,6 +34,7 @@ import java.util.concurrent.ConcurrentHashMap; * * @author Lucas Ward * @author Douglas Kaminsky + * @author Mahmoud Ben Hassine */ @SuppressWarnings("serial") public class ExecutionContext implements Serializable { @@ -74,13 +77,14 @@ public class ExecutionContext implements Serializable { } /** - * Adds a String value to the context. + * Adds a String value to the context. Putting null + * value for a given key removes the key. * * @param key Key to add to context * @param value Value to associate with key */ - public void putString(String key, String value) { + public void putString(String key, @Nullable String value) { put(key, value); } @@ -124,7 +128,7 @@ public class ExecutionContext implements Serializable { * @param key Key to add to context * @param value Value to associate with key */ - public void put(String key, Object value) { + public void put(String key, @Nullable Object value) { if (value != null) { Object result = map.put(key, value); dirty = result==null || result!=null && !result.equals(value); @@ -152,6 +156,7 @@ public class ExecutionContext implements Serializable { * @param key The key to get a value for * @return The String value */ + @Nullable public String getString(String key) { return (String) readAndValidate(key, String.class); @@ -166,6 +171,7 @@ public class ExecutionContext implements Serializable { * @return The String value if key is represented, specified * default otherwise */ + @Nullable public String getString(String key, String defaultString) { if (!map.containsKey(key)) { return defaultString; @@ -263,6 +269,7 @@ public class ExecutionContext implements Serializable { * @param key The key to get a value for * @return The value represented by the given key */ + @Nullable public Object get(String key) { return map.get(key); } @@ -333,6 +340,7 @@ public class ExecutionContext implements Serializable { * * @see java.util.Map#remove(Object) */ + @Nullable public Object remove(String key) { return map.remove(key); } diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/ItemProcessor.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/ItemProcessor.java index 3f77c9f94..aa7808ae3 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/ItemProcessor.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/ItemProcessor.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2007 the original author or authors. + * Copyright 2006-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,6 +16,8 @@ package org.springframework.batch.item; +import org.springframework.lang.Nullable; + /** * Interface for item transformation. Given an item as input, this interface provides * an extension point which allows for the application of business logic in an item @@ -25,6 +27,7 @@ package org.springframework.batch.item; * * @author Robert Kasanicky * @author Dave Syer + * @author Mahmoud Ben Hassine */ public interface ItemProcessor { @@ -34,10 +37,11 @@ public interface ItemProcessor { * should not continue. * * @param item to be processed - * @return potentially modified or new item for continued processing, null if processing of the + * @return potentially modified or new item for continued processing, {@code null} if processing of the * provided item should not continue. * * @throws Exception thrown if exception occurs during processing. */ + @Nullable O process(I item) throws Exception; } diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/ItemReader.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/ItemReader.java index 4ccd0233c..f9586879f 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/ItemReader.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/ItemReader.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2007 the original author or authors. + * Copyright 2006-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,6 +16,8 @@ package org.springframework.batch.item; +import org.springframework.lang.Nullable; + /** * Strategy interface for providing the data.
* @@ -32,6 +34,7 @@ package org.springframework.batch.item; * @author Rob Harrop * @author Dave Syer * @author Lucas Ward + * @author Mahmoud Ben Hassine * @since 1.0 */ public interface ItemReader { @@ -52,8 +55,10 @@ public interface ItemReader { * with the input data. Assume potentially transient, so subsequent calls to * read might succeed. * @throws Exception if an there is a non-specific error. - * @return T the item to be processed + * @return T the item to be processed or {@code null} if the data source is + * exhausted */ + @Nullable T read() throws Exception, UnexpectedInputException, ParseException, NonTransientResourceException; } diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/PeekableItemReader.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/PeekableItemReader.java index 995fb64d1..6c37593d2 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/PeekableItemReader.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/PeekableItemReader.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2010 the original author or authors. + * Copyright 2006-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,6 +15,8 @@ */ package org.springframework.batch.item; +import org.springframework.lang.Nullable; + /** *

* A specialisation of {@link ItemReader} that allows the user to look ahead @@ -33,6 +35,7 @@ package org.springframework.batch.item; *

* * @author Dave Syer + * @author Mahmoud Ben Hassine * */ public interface PeekableItemReader extends ItemReader { @@ -41,9 +44,10 @@ public interface PeekableItemReader extends ItemReader { * Get the next item that would be returned by {@link #read()}, without * affecting the result of {@link #read()}. * - * @return the next item + * @return the next item or {@code null} if the data source is exhausted * @throws Exception if there is a problem */ + @Nullable T peek() throws Exception, UnexpectedInputException, ParseException; } diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/adapter/package-info.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/adapter/package-info.java index 45c6f3c5a..db2847283 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/adapter/package-info.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/adapter/package-info.java @@ -3,4 +3,7 @@ * Adapters for Plain Old Java Objects. *

*/ -package org.springframework.batch.item.adapter; \ No newline at end of file +@NonNullApi +package org.springframework.batch.item.adapter; + +import org.springframework.lang.NonNullApi; diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/amqp/builder/package-info.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/amqp/builder/package-info.java new file mode 100644 index 000000000..383bc541f --- /dev/null +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/amqp/builder/package-info.java @@ -0,0 +1,26 @@ +/* + * Copyright 2018 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * Builders for AMQP item reader and writer. + * + * @author Mahmoud Ben Hassine + */ + +@NonNullApi +package org.springframework.batch.item.amqp.builder; + +import org.springframework.lang.NonNullApi; diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/amqp/package-info.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/amqp/package-info.java index 479b6e0bb..aa419383c 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/amqp/package-info.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/amqp/package-info.java @@ -2,5 +2,9 @@ * AMQP related batch components. * * @author Michael Minella + * @author Mahmoud Ben Hassine */ -package org.springframework.batch.item.amqp; \ No newline at end of file +@NonNullApi +package org.springframework.batch.item.amqp; + +import org.springframework.lang.NonNullApi; diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/data/builder/package-info.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/data/builder/package-info.java new file mode 100644 index 000000000..439e841e0 --- /dev/null +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/data/builder/package-info.java @@ -0,0 +1,25 @@ +/* + * Copyright 2018 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * Builders for Spring Data item readers and writers. + * + * @author Mahmoud Ben Hassine + */ +@NonNullApi +package org.springframework.batch.item.data.builder; + +import org.springframework.lang.NonNullApi; diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/data/package-info.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/data/package-info.java index 6918b224d..b4029d2f3 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/data/package-info.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/data/package-info.java @@ -2,5 +2,9 @@ * Spring Data related readers and writers. * * @author Michael Minella + * @author Mahmoud Ben Hassine */ -package org.springframework.batch.item.data; \ No newline at end of file +@NonNullApi +package org.springframework.batch.item.data; + +import org.springframework.lang.NonNullApi; diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/AbstractCursorItemReader.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/AbstractCursorItemReader.java index 3dae2dcb7..a6cfb4f43 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/AbstractCursorItemReader.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/AbstractCursorItemReader.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2017 the original author or authors. + * Copyright 2006-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -40,6 +40,7 @@ import org.springframework.jdbc.support.JdbcUtils; import org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator; import org.springframework.jdbc.support.SQLExceptionTranslator; import org.springframework.jdbc.support.SQLStateSQLExceptionTranslator; +import org.springframework.lang.Nullable; import org.springframework.transaction.support.TransactionSynchronizationManager; import org.springframework.util.Assert; @@ -103,6 +104,7 @@ import org.springframework.util.Assert; * @author Robert Kasanicky * @author Thomas Risberg * @author Michael Minella + * @author Mahmoud Ben Hassine */ public abstract class AbstractCursorItemReader extends AbstractItemCountingItemStreamItemReader implements InitializingBean { @@ -492,6 +494,7 @@ implements InitializingBean { * @return the mapped object at the cursor position * @throws SQLException if interactions with the current result set fail */ + @Nullable protected abstract T readCursor(ResultSet rs, int currentRow) throws SQLException; /** diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/builder/package-info.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/builder/package-info.java new file mode 100644 index 000000000..457ba213a --- /dev/null +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/builder/package-info.java @@ -0,0 +1,25 @@ +/* + * Copyright 2018 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * Builders for database item readers and writers. + * + * @author Mahmoud Ben Hassine + */ +@NonNullApi +package org.springframework.batch.item.database.builder; + +import org.springframework.lang.NonNullApi; diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/orm/package-info.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/orm/package-info.java index edf47c35e..97d032d38 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/orm/package-info.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/orm/package-info.java @@ -2,5 +2,9 @@ * Support classes for components using various ORM related technologies. * * @author Michael Minella + * @author Mahmoud Ben Hassine */ -package org.springframework.batch.item.database.orm; \ No newline at end of file +@NonNullApi +package org.springframework.batch.item.database.orm; + +import org.springframework.lang.NonNullApi; diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/package-info.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/package-info.java index 056bac1a5..801309e02 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/package-info.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/package-info.java @@ -3,4 +3,7 @@ * Infrastructure implementations of database based item readers and writers. *

*/ -package org.springframework.batch.item.database; \ No newline at end of file +@NonNullApi +package org.springframework.batch.item.database; + +import org.springframework.lang.NonNullApi; diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/support/package-info.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/support/package-info.java index af23cc46f..67d58af49 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/support/package-info.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/support/package-info.java @@ -2,5 +2,9 @@ * Support classes for database specific semantics. * * @author Michael Minella + * @author Mahmoud Ben Hassine */ -package org.springframework.batch.item.database.support; \ No newline at end of file +@NonNullApi +package org.springframework.batch.item.database.support; + +import org.springframework.lang.NonNullApi; diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/MultiResourceItemReader.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/MultiResourceItemReader.java index 4abdf3956..1185f3809 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/MultiResourceItemReader.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/MultiResourceItemReader.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2007 the original author or authors. + * Copyright 2006-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,6 +29,7 @@ import org.springframework.batch.item.ResourceAware; import org.springframework.batch.item.UnexpectedInputException; import org.springframework.batch.item.support.AbstractItemStreamItemReader; import org.springframework.core.io.Resource; +import org.springframework.lang.Nullable; import org.springframework.util.Assert; import org.springframework.util.ClassUtils; @@ -42,6 +43,7 @@ import org.springframework.util.ClassUtils; * * @author Robert Kasanicky * @author Lucas Ward + * @author Mahmoud Ben Hassine */ public class MultiResourceItemReader extends AbstractItemStreamItemReader { @@ -244,6 +246,12 @@ public class MultiResourceItemReader extends AbstractItemStreamItemReader this.resources = Arrays.asList(resources).toArray(new Resource[resources.length]); } + /** + * Getter for the current resource. + * @return the current resource or {@code null} if all resources have been + * processed or the first resource has not been assigned yet. + */ + @Nullable public Resource getCurrentResource() { if (currentResource >= resources.length || currentResource < 0) { return null; diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/ResourcesItemReader.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/ResourcesItemReader.java index cca85d187..e3b77efde 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/ResourcesItemReader.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/ResourcesItemReader.java @@ -1,5 +1,5 @@ /* - * Copyright 2009-2014 the original author or authors. + * Copyright 2009-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,6 +21,7 @@ import org.springframework.batch.item.ItemStreamException; import org.springframework.batch.item.support.AbstractItemStreamItemReader; import org.springframework.core.io.Resource; import org.springframework.core.io.support.ResourceArrayPropertyEditor; +import org.springframework.lang.Nullable; import java.util.Arrays; import java.util.concurrent.atomic.AtomicInteger; @@ -39,6 +40,7 @@ import java.util.concurrent.atomic.AtomicInteger; * do not rely on that data for restart (i.e. always open with a fresh context). * * @author Dave Syer + * @author Mahmoud Ben Hassine * * @see ResourceArrayPropertyEditor * @@ -68,9 +70,10 @@ public class ResourcesItemReader extends AbstractItemStreamItemReader /** * Increments a counter and returns the next {@link Resource} instance from - * the input, or null if none remain. + * the input, or {@code null} if none remain. */ @Override + @Nullable public synchronized Resource read() throws Exception { int index = counter.incrementAndGet() - 1; if (index >= resources.length) { diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/builder/package-info.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/builder/package-info.java new file mode 100644 index 000000000..275ac44ea --- /dev/null +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/builder/package-info.java @@ -0,0 +1,25 @@ +/* + * Copyright 2018 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * Builders for file item readers and writers. + * + * @author Mahmoud Ben Hassine + */ +@NonNullApi +package org.springframework.batch.item.file.builder; + +import org.springframework.lang.NonNullApi; diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/mapping/package-info.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/mapping/package-info.java index 9d629c503..3405d55d1 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/mapping/package-info.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/mapping/package-info.java @@ -3,4 +3,7 @@ * Infrastructure implementations of io file support mapping concerns. *

*/ -package org.springframework.batch.item.file.mapping; \ No newline at end of file +@NonNullApi +package org.springframework.batch.item.file.mapping; + +import org.springframework.lang.NonNullApi; diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/package-info.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/package-info.java index 3b5cdafb3..4365cd486 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/package-info.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/package-info.java @@ -3,4 +3,7 @@ * Infrastructure implementations of io file concerns. *

*/ -package org.springframework.batch.item.file; \ No newline at end of file +@NonNullApi +package org.springframework.batch.item.file; + +import org.springframework.lang.NonNullApi; diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/separator/package-info.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/separator/package-info.java index 3037e3601..87f48e90e 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/separator/package-info.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/separator/package-info.java @@ -3,4 +3,7 @@ * Infrastructure implementations of io file support separator concerns. *

*/ -package org.springframework.batch.item.file.separator; \ No newline at end of file +@NonNullApi +package org.springframework.batch.item.file.separator; + +import org.springframework.lang.NonNullApi; diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/transform/package-info.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/transform/package-info.java index 7bfc7f725..4c5085445 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/transform/package-info.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/transform/package-info.java @@ -3,4 +3,7 @@ * Infrastructure implementations of io file support transform concerns. *

*/ -package org.springframework.batch.item.file.transform; \ No newline at end of file +@NonNullApi +package org.springframework.batch.item.file.transform; + +import org.springframework.lang.NonNullApi; diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/function/package-info.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/function/package-info.java new file mode 100644 index 000000000..c9e827468 --- /dev/null +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/function/package-info.java @@ -0,0 +1,25 @@ +/* + * Copyright 2018 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * Adapters for {@link java.util.function} components. + * + * @author Mahmoud Ben Hassine + */ +@NonNullApi +package org.springframework.batch.item.function; + +import org.springframework.lang.NonNullApi; diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/jms/JmsMethodInvocationRecoverer.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/jms/JmsMethodInvocationRecoverer.java index 5b6be5418..dd6641b6f 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/jms/JmsMethodInvocationRecoverer.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/jms/JmsMethodInvocationRecoverer.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2007 the original author or authors. + * Copyright 2006-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,12 +17,15 @@ package org.springframework.batch.item.jms; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; + +import org.springframework.lang.Nullable; import org.springframework.retry.interceptor.MethodInvocationRecoverer; import org.springframework.jms.JmsException; import org.springframework.jms.core.JmsOperations; /** * @author Dave Syer + * @author Mahmoud Ben Hassine * */ public class JmsMethodInvocationRecoverer implements MethodInvocationRecoverer { @@ -42,12 +45,13 @@ public class JmsMethodInvocationRecoverer implements MethodInvocationRecovere /** * Send one message per item in the arguments list using the default destination of - * the jms template. If the recovery is successful null is returned. + * the jms template. If the recovery is successful {@code null} is returned. * * @see org.springframework.retry.interceptor.MethodInvocationRecoverer#recover(Object[], * Throwable) */ @Override + @Nullable public T recover(Object[] items, Throwable cause) { try { for (Object item : items) { diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/jms/builder/package-info.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/jms/builder/package-info.java new file mode 100644 index 000000000..51aadc79c --- /dev/null +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/jms/builder/package-info.java @@ -0,0 +1,25 @@ +/* + * Copyright 2018 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * Builders for JMS item reader and writer. + * + * @author Mahmoud Ben Hassine + */ +@NonNullApi +package org.springframework.batch.item.jms.builder; + +import org.springframework.lang.NonNullApi; diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/jms/package-info.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/jms/package-info.java index e5e0215ce..2e0e156aa 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/jms/package-info.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/jms/package-info.java @@ -2,5 +2,9 @@ * JMS based reader/writer and related components. * * @author Michael Minella + * @author Mahmoud Ben Hassine */ -package org.springframework.batch.item.jms; \ No newline at end of file +@NonNullApi +package org.springframework.batch.item.jms; + +import org.springframework.lang.NonNullApi; diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/json/JsonObjectReader.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/json/JsonObjectReader.java index 42b54f87c..26d2c99f7 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/json/JsonObjectReader.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/json/JsonObjectReader.java @@ -17,6 +17,7 @@ package org.springframework.batch.item.json; import org.springframework.core.io.Resource; +import org.springframework.lang.Nullable; /** * Strategy interface for Json readers. Implementations are expected to use @@ -40,9 +41,10 @@ public interface JsonObjectReader { /** * Read the next object in the Json resource if any. - * @return the next object or null if the resource is exhausted + * @return the next object or {@code null} if the resource is exhausted * @throws Exception if unable to read the next object */ + @Nullable T read() throws Exception; /** diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/json/builder/package-info.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/json/builder/package-info.java new file mode 100644 index 000000000..147ab0af7 --- /dev/null +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/json/builder/package-info.java @@ -0,0 +1,25 @@ +/* + * Copyright 2018 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * Builders for JSON item reader and writer. + * + * @author Mahmoud Ben Hassine + */ +@NonNullApi +package org.springframework.batch.item.json.builder; + +import org.springframework.lang.NonNullApi; diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/json/package-info.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/json/package-info.java index 9e3dcccab..667ea7181 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/json/package-info.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/json/package-info.java @@ -5,4 +5,7 @@ * * @author Mahmoud Ben Hassine */ +@NonNullApi package org.springframework.batch.item.json; + +import org.springframework.lang.NonNullApi; diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/ldif/RecordMapper.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/ldif/RecordMapper.java index fffb0a63f..1210bb9b6 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/ldif/RecordMapper.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/ldif/RecordMapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2014 the original author or authors. + * Copyright 2005-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,6 +15,7 @@ */ package org.springframework.batch.item.ldif; +import org.springframework.lang.Nullable; import org.springframework.ldap.core.LdapAttributes; /** @@ -22,6 +23,7 @@ import org.springframework.ldap.core.LdapAttributes; * implementations can be used in the {@link MappingLdifReader MappingLdifReader}. * * @author Keith Barlow + * @author Mahmoud Ben Hassine * * @param type the record will be mapped to */ @@ -31,8 +33,10 @@ public interface RecordMapper { * Maps an {@link LdapAttributes LdapAttributes} object to the specified type. * * @param attributes attributes - * @return object of type T + * @return object of type T or {@code null} if unable to map the record to + * an object. */ + @Nullable T mapRecord(LdapAttributes attributes); -} \ No newline at end of file +} diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/ldif/builder/package-info.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/ldif/builder/package-info.java new file mode 100644 index 000000000..04d6f136d --- /dev/null +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/ldif/builder/package-info.java @@ -0,0 +1,25 @@ +/* + * Copyright 2018 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * Builders for LDIF related components. + * + * @author Mahmoud Ben Hassine + */ +@NonNullApi +package org.springframework.batch.item.ldif.builder; + +import org.springframework.lang.NonNullApi; diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/ldif/package-info.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/ldif/package-info.java index 5c313e324..de9ae6f8f 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/ldif/package-info.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/ldif/package-info.java @@ -2,5 +2,9 @@ *

This package contains the classes required for using the LdifParser in Spring LDAP.

* * @author Michael Minella + * @author Mahmoud Ben Hassine */ -package org.springframework.batch.item.ldif; \ No newline at end of file +@NonNullApi +package org.springframework.batch.item.ldif; + +import org.springframework.lang.NonNullApi; diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/mail/builder/package-info.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/mail/builder/package-info.java new file mode 100644 index 000000000..892143266 --- /dev/null +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/mail/builder/package-info.java @@ -0,0 +1,25 @@ +/* + * Copyright 2018 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * Builders for JavaMail related components. + * + * @author Mahmoud Ben Hassine + */ +@NonNullApi +package org.springframework.batch.item.mail.builder; + +import org.springframework.lang.NonNullApi; diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/mail/javamail/package-info.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/mail/javamail/package-info.java new file mode 100644 index 000000000..65c6e8580 --- /dev/null +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/mail/javamail/package-info.java @@ -0,0 +1,25 @@ +/* + * Copyright 2018 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * JavaMail related components. + * + * @author Mahmoud Ben Hassine + */ +@NonNullApi +package org.springframework.batch.item.mail.javamail; + +import org.springframework.lang.NonNullApi; diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/mail/package-info.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/mail/package-info.java index 8bae035ee..413f4b383 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/mail/package-info.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/mail/package-info.java @@ -2,5 +2,9 @@ * Java Mail based components. * * @author Michael Minella + * @author Mahmoud Ben Hassine */ -package org.springframework.batch.item.mail; \ No newline at end of file +@NonNullApi +package org.springframework.batch.item.mail; + +import org.springframework.lang.NonNullApi; diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/package-info.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/package-info.java index 582937b61..ae555480b 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/package-info.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/package-info.java @@ -3,4 +3,7 @@ * Infrastructure interfaces and primary dependencies for item concerns. *

*/ -package org.springframework.batch.item; \ No newline at end of file +@NonNullApi +package org.springframework.batch.item; + +import org.springframework.lang.NonNullApi; diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/support/AbstractItemCountingItemStreamItemReader.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/support/AbstractItemCountingItemStreamItemReader.java index f63d38c1a..b632751fd 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/support/AbstractItemCountingItemStreamItemReader.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/support/AbstractItemCountingItemStreamItemReader.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2013 the original author or authors. + * Copyright 2006-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,6 +22,7 @@ import org.springframework.batch.item.ItemReader; import org.springframework.batch.item.ItemStreamException; import org.springframework.batch.item.ParseException; import org.springframework.batch.item.UnexpectedInputException; +import org.springframework.lang.Nullable; import org.springframework.util.Assert; /** @@ -33,6 +34,7 @@ import org.springframework.util.Assert; * * @author Robert Kasanicky * @author Glenn Renfro + * @author Mahmoud Ben Hassine */ public abstract class AbstractItemCountingItemStreamItemReader extends AbstractItemStreamItemReader { @@ -49,9 +51,10 @@ public abstract class AbstractItemCountingItemStreamItemReader extends Abstra /** * Read next item from input. * - * @return item + * @return an item or {@code null} if the data source is exhausted * @throws Exception Allows subclasses to throw checked exceptions for interpretation by the framework */ + @Nullable protected abstract T doRead() throws Exception; /** diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/support/builder/package-info.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/support/builder/package-info.java new file mode 100644 index 000000000..c432bc49a --- /dev/null +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/support/builder/package-info.java @@ -0,0 +1,25 @@ +/* + * Copyright 2018 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * Builders for support classes. + * + * @author Mahmoud Ben Hassine + */ +@NonNullApi +package org.springframework.batch.item.support.builder; + +import org.springframework.lang.NonNullApi; diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/support/package-info.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/support/package-info.java index d91de2700..3b67e5685 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/support/package-info.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/support/package-info.java @@ -3,4 +3,7 @@ * Internal support package *

*/ -package org.springframework.batch.item.support; \ No newline at end of file +@NonNullApi +package org.springframework.batch.item.support; + +import org.springframework.lang.NonNullApi; diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/util/package-info.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/util/package-info.java new file mode 100644 index 000000000..8c38587fe --- /dev/null +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/util/package-info.java @@ -0,0 +1,25 @@ +/* + * Copyright 2018 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * Infrastructure utility classes. + * + * @author Mahmoud Ben Hassine + */ +@NonNullApi +package org.springframework.batch.item.util; + +import org.springframework.lang.NonNullApi; diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/validator/package-info.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/validator/package-info.java index 3498aca64..c56d78dab 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/validator/package-info.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/validator/package-info.java @@ -3,4 +3,7 @@ * Infrastructure implementations of item validator concerns. *

*/ -package org.springframework.batch.item.validator; \ No newline at end of file +@NonNullApi +package org.springframework.batch.item.validator; + +import org.springframework.lang.NonNullApi; diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/xml/builder/package-info.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/xml/builder/package-info.java new file mode 100644 index 000000000..374bc2a99 --- /dev/null +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/xml/builder/package-info.java @@ -0,0 +1,25 @@ +/* + * Copyright 2018 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * Builders for Stax event item reader and writer. + * + * @author Mahmoud Ben Hassine + */ +@NonNullApi +package org.springframework.batch.item.xml.builder; + +import org.springframework.lang.NonNullApi; diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/xml/package-info.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/xml/package-info.java index 51faa8be0..6b81565cb 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/xml/package-info.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/xml/package-info.java @@ -3,4 +3,7 @@ * Infrastructure implementations of xml input and output. *

*/ -package org.springframework.batch.item.xml; \ No newline at end of file +@NonNullApi +package org.springframework.batch.item.xml; + +import org.springframework.lang.NonNullApi; diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/xml/stax/package-info.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/xml/stax/package-info.java new file mode 100644 index 000000000..4b39fac71 --- /dev/null +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/xml/stax/package-info.java @@ -0,0 +1,25 @@ +/* + * Copyright 2018 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * Item reader and writer based on Stax. + * + * @author Mahmoud Ben Hassine + */ +@NonNullApi +package org.springframework.batch.item.xml.stax; + +import org.springframework.lang.NonNullApi; diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/jsr/item/package-info.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/jsr/item/package-info.java index bc5408217..c4cad41a1 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/jsr/item/package-info.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/jsr/item/package-info.java @@ -2,5 +2,9 @@ * Components for adapting JSR item based components to Spring Batch. * * @author Michael Minella + * @author Mahmoud Ben Hassine */ -package org.springframework.batch.jsr.item; \ No newline at end of file +@NonNullApi +package org.springframework.batch.jsr.item; + +import org.springframework.lang.NonNullApi; diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/jsr/repeat/package-info.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/jsr/repeat/package-info.java new file mode 100644 index 000000000..b99952133 --- /dev/null +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/jsr/repeat/package-info.java @@ -0,0 +1,25 @@ +/* + * Copyright 2018 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * APIs for JSR-352 repeat support. + * + * @author Mahmoud Ben Hassine + */ +@NonNullApi +package org.springframework.batch.jsr.repeat; + +import org.springframework.lang.NonNullApi; diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/package-info.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/package-info.java index db2b1bfae..8293c2f96 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/package-info.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/package-info.java @@ -3,4 +3,7 @@ * Infrastructure implementations of . concerns. *

*/ -package org.springframework.batch; \ No newline at end of file +@NonNullApi +package org.springframework.batch; + +import org.springframework.lang.NonNullApi; diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/poller/package-info.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/poller/package-info.java new file mode 100644 index 000000000..c73c4aa3e --- /dev/null +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/poller/package-info.java @@ -0,0 +1,25 @@ +/* + * Copyright 2018 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * APIs for polling support. + * + * @author Mahmoud Ben Hassine + */ +@NonNullApi +package org.springframework.batch.poller; + +import org.springframework.lang.NonNullApi; diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/callback/package-info.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/callback/package-info.java index 39c2cbcc6..878daec20 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/callback/package-info.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/callback/package-info.java @@ -3,4 +3,7 @@ * Infrastructure implementations of repeat callback concerns. *

*/ -package org.springframework.batch.repeat.callback; \ No newline at end of file +@NonNullApi +package org.springframework.batch.repeat.callback; + +import org.springframework.lang.NonNullApi; diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/context/package-info.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/context/package-info.java index 3f9236610..e8d0f11f9 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/context/package-info.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/context/package-info.java @@ -3,4 +3,7 @@ * Infrastructure implementations of repeat context concerns. *

*/ -package org.springframework.batch.repeat.context; \ No newline at end of file +@NonNullApi +package org.springframework.batch.repeat.context; + +import org.springframework.lang.NonNullApi; diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/exception/package-info.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/exception/package-info.java index ea2f62961..e32d20693 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/exception/package-info.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/exception/package-info.java @@ -3,4 +3,7 @@ * Infrastructure implementations of repeat exception handler concerns. *

*/ -package org.springframework.batch.repeat.exception; \ No newline at end of file +@NonNullApi +package org.springframework.batch.repeat.exception; + +import org.springframework.lang.NonNullApi; diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/interceptor/package-info.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/interceptor/package-info.java index 4223c403e..d67cb6a46 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/interceptor/package-info.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/interceptor/package-info.java @@ -3,4 +3,7 @@ * Infrastructure implementations of repeat aop concerns. *

*/ -package org.springframework.batch.repeat.interceptor; \ No newline at end of file +@NonNullApi +package org.springframework.batch.repeat.interceptor; + +import org.springframework.lang.NonNullApi; diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/listener/package-info.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/listener/package-info.java index a0aa0698f..db3be41da 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/listener/package-info.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/listener/package-info.java @@ -3,4 +3,7 @@ * Infrastructure implementations of repeat interceptor concerns. *

*/ -package org.springframework.batch.repeat.listener; \ No newline at end of file +@NonNullApi +package org.springframework.batch.repeat.listener; + +import org.springframework.lang.NonNullApi; diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/package-info.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/package-info.java index 83970c534..e247cdbee 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/package-info.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/package-info.java @@ -3,4 +3,7 @@ * Infrastructure implementations of repeat concerns. *

*/ -package org.springframework.batch.repeat; \ No newline at end of file +@NonNullApi +package org.springframework.batch.repeat; + +import org.springframework.lang.NonNullApi; diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/policy/package-info.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/policy/package-info.java index 379b76c4a..6cdf5440d 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/policy/package-info.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/policy/package-info.java @@ -3,4 +3,7 @@ * Infrastructure implementations of repeat policy concerns. *

*/ -package org.springframework.batch.repeat.policy; \ No newline at end of file +@NonNullApi +package org.springframework.batch.repeat.policy; + +import org.springframework.lang.NonNullApi; diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/support/package-info.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/support/package-info.java index 35b4879e8..6d690403c 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/support/package-info.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/support/package-info.java @@ -3,4 +3,7 @@ * Infrastructure implementations of repeat support concerns. *

*/ -package org.springframework.batch.repeat.support; \ No newline at end of file +@NonNullApi +package org.springframework.batch.repeat.support; + +import org.springframework.lang.NonNullApi; diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/support/MethodInvoker.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/support/MethodInvoker.java index 46f3992af..419c6ce00 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/support/MethodInvoker.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/support/MethodInvoker.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,14 +16,18 @@ package org.springframework.batch.support; +import org.springframework.lang.Nullable; + /** * A strategy interface for invoking a method. * Typically used by adapters. * * @author Mark Fisher + * @author Mahmoud Ben Hassine */ public interface MethodInvoker { + @Nullable Object invokeMethod(Object ... args); } diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/support/MethodResolver.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/support/MethodResolver.java index 3cab3454f..8cd02734e 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/support/MethodResolver.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/support/MethodResolver.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,10 +18,13 @@ package org.springframework.batch.support; import java.lang.reflect.Method; +import org.springframework.lang.Nullable; + /** * Strategy interface for detecting a single Method on a Class. * * @author Mark Fisher + * @author Mahmoud Ben Hassine */ public interface MethodResolver { @@ -38,6 +41,7 @@ public interface MethodResolver { * @throws IllegalArgumentException if more than one Method defined on the * given candidate's Class matches this resolver's criteria */ + @Nullable Method findMethod(Object candidate) throws IllegalArgumentException; /** @@ -52,6 +56,7 @@ public interface MethodResolver { * @throws IllegalArgumentException if more than one Method defined on the * given Class matches this resolver's criteria */ + @Nullable Method findMethod(Class clazz); } diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/support/package-info.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/support/package-info.java index b24b6ce9b..01ab17a99 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/support/package-info.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/support/package-info.java @@ -3,4 +3,7 @@ * Infrastructure implementations of support concerns. *

*/ -package org.springframework.batch.support; \ No newline at end of file +@NonNullApi +package org.springframework.batch.support; + +import org.springframework.lang.NonNullApi; diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/support/transaction/package-info.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/support/transaction/package-info.java index 80d6d52d8..19e932270 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/support/transaction/package-info.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/support/transaction/package-info.java @@ -3,4 +3,7 @@ * Infrastructure implementations of support transaction concerns. *

*/ -package org.springframework.batch.support.transaction; \ No newline at end of file +@NonNullApi +package org.springframework.batch.support.transaction; + +import org.springframework.lang.NonNullApi;