Add JSR-305 annotations to public APIs

(Partially) Resolves BATCH-2688
This commit is contained in:
Mahmoud Ben Hassine
2018-07-17 11:02:44 +02:00
parent f282be1458
commit 96a0fc825e
59 changed files with 609 additions and 53 deletions

View File

@@ -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 <code>null</code>
* 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 <code>String</code> value
*/
@Nullable
public String getString(String key) {
return (String) readAndValidate(key, String.class);
@@ -166,6 +171,7 @@ public class ExecutionContext implements Serializable {
* @return The <code>String</code> 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);
}

View File

@@ -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<I, O> {
@@ -34,10 +37,11 @@ public interface ItemProcessor<I, O> {
* 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;
}

View File

@@ -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. <br>
*
@@ -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<T> {
@@ -52,8 +55,10 @@ public interface ItemReader<T> {
* 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;
}

View File

@@ -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;
/**
* <p>
* A specialisation of {@link ItemReader} that allows the user to look ahead
@@ -33,6 +35,7 @@ package org.springframework.batch.item;
* </p>
*
* @author Dave Syer
* @author Mahmoud Ben Hassine
*
*/
public interface PeekableItemReader<T> extends ItemReader<T> {
@@ -41,9 +44,10 @@ public interface PeekableItemReader<T> extends ItemReader<T> {
* 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;
}

View File

@@ -3,4 +3,7 @@
* Adapters for Plain Old Java Objects.
* </p>
*/
package org.springframework.batch.item.adapter;
@NonNullApi
package org.springframework.batch.item.adapter;
import org.springframework.lang.NonNullApi;

View File

@@ -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;

View File

@@ -2,5 +2,9 @@
* AMQP related batch components.
*
* @author Michael Minella
* @author Mahmoud Ben Hassine
*/
package org.springframework.batch.item.amqp;
@NonNullApi
package org.springframework.batch.item.amqp;
import org.springframework.lang.NonNullApi;

View File

@@ -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;

View File

@@ -2,5 +2,9 @@
* Spring Data related readers and writers.
*
* @author Michael Minella
* @author Mahmoud Ben Hassine
*/
package org.springframework.batch.item.data;
@NonNullApi
package org.springframework.batch.item.data;
import org.springframework.lang.NonNullApi;

View File

@@ -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<T> extends AbstractItemCountingItemStreamItemReader<T>
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;
/**

View File

@@ -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;

View File

@@ -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;
@NonNullApi
package org.springframework.batch.item.database.orm;
import org.springframework.lang.NonNullApi;

View File

@@ -3,4 +3,7 @@
* Infrastructure implementations of database based item readers and writers.
* </p>
*/
package org.springframework.batch.item.database;
@NonNullApi
package org.springframework.batch.item.database;
import org.springframework.lang.NonNullApi;

View File

@@ -2,5 +2,9 @@
* Support classes for database specific semantics.
*
* @author Michael Minella
* @author Mahmoud Ben Hassine
*/
package org.springframework.batch.item.database.support;
@NonNullApi
package org.springframework.batch.item.database.support;
import org.springframework.lang.NonNullApi;

View File

@@ -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<T> extends AbstractItemStreamItemReader<T> {
@@ -244,6 +246,12 @@ public class MultiResourceItemReader<T> extends AbstractItemStreamItemReader<T>
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;

View File

@@ -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<Resource>
/**
* 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) {

View File

@@ -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;

View File

@@ -3,4 +3,7 @@
* Infrastructure implementations of io file support mapping concerns.
* </p>
*/
package org.springframework.batch.item.file.mapping;
@NonNullApi
package org.springframework.batch.item.file.mapping;
import org.springframework.lang.NonNullApi;

View File

@@ -3,4 +3,7 @@
* Infrastructure implementations of io file concerns.
* </p>
*/
package org.springframework.batch.item.file;
@NonNullApi
package org.springframework.batch.item.file;
import org.springframework.lang.NonNullApi;

View File

@@ -3,4 +3,7 @@
* Infrastructure implementations of io file support separator concerns.
* </p>
*/
package org.springframework.batch.item.file.separator;
@NonNullApi
package org.springframework.batch.item.file.separator;
import org.springframework.lang.NonNullApi;

View File

@@ -3,4 +3,7 @@
* Infrastructure implementations of io file support transform concerns.
* </p>
*/
package org.springframework.batch.item.file.transform;
@NonNullApi
package org.springframework.batch.item.file.transform;
import org.springframework.lang.NonNullApi;

View File

@@ -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;

View File

@@ -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<T> implements MethodInvocationRecoverer<T> {
@@ -42,12 +45,13 @@ public class JmsMethodInvocationRecoverer<T> 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) {

View File

@@ -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;

View File

@@ -2,5 +2,9 @@
* JMS based reader/writer and related components.
*
* @author Michael Minella
* @author Mahmoud Ben Hassine
*/
package org.springframework.batch.item.jms;
@NonNullApi
package org.springframework.batch.item.jms;
import org.springframework.lang.NonNullApi;

View File

@@ -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<T> {
/**
* 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;
/**

View File

@@ -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;

View File

@@ -5,4 +5,7 @@
*
* @author Mahmoud Ben Hassine
*/
@NonNullApi
package org.springframework.batch.item.json;
import org.springframework.lang.NonNullApi;

View File

@@ -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 <T> type the record will be mapped to
*/
@@ -31,8 +33,10 @@ public interface RecordMapper<T> {
* 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);
}
}

View File

@@ -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;

View File

@@ -2,5 +2,9 @@
* <p>This package contains the classes required for using the LdifParser in Spring LDAP.</p>
*
* @author Michael Minella
* @author Mahmoud Ben Hassine
*/
package org.springframework.batch.item.ldif;
@NonNullApi
package org.springframework.batch.item.ldif;
import org.springframework.lang.NonNullApi;

View File

@@ -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;

View File

@@ -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;

View File

@@ -2,5 +2,9 @@
* Java Mail based components.
*
* @author Michael Minella
* @author Mahmoud Ben Hassine
*/
package org.springframework.batch.item.mail;
@NonNullApi
package org.springframework.batch.item.mail;
import org.springframework.lang.NonNullApi;

View File

@@ -3,4 +3,7 @@
* Infrastructure interfaces and primary dependencies for item concerns.
* </p>
*/
package org.springframework.batch.item;
@NonNullApi
package org.springframework.batch.item;
import org.springframework.lang.NonNullApi;

View File

@@ -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<T> extends AbstractItemStreamItemReader<T> {
@@ -49,9 +51,10 @@ public abstract class AbstractItemCountingItemStreamItemReader<T> 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;
/**

View File

@@ -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;

View File

@@ -3,4 +3,7 @@
* Internal support package
* </p>
*/
package org.springframework.batch.item.support;
@NonNullApi
package org.springframework.batch.item.support;
import org.springframework.lang.NonNullApi;

View File

@@ -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;

View File

@@ -3,4 +3,7 @@
* Infrastructure implementations of item validator concerns.
* </p>
*/
package org.springframework.batch.item.validator;
@NonNullApi
package org.springframework.batch.item.validator;
import org.springframework.lang.NonNullApi;

View File

@@ -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;

View File

@@ -3,4 +3,7 @@
* Infrastructure implementations of xml input and output.
* </p>
*/
package org.springframework.batch.item.xml;
@NonNullApi
package org.springframework.batch.item.xml;
import org.springframework.lang.NonNullApi;

View File

@@ -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;

View File

@@ -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;
@NonNullApi
package org.springframework.batch.jsr.item;
import org.springframework.lang.NonNullApi;

View File

@@ -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;

View File

@@ -3,4 +3,7 @@
* Infrastructure implementations of . concerns.
* </p>
*/
package org.springframework.batch;
@NonNullApi
package org.springframework.batch;
import org.springframework.lang.NonNullApi;

View File

@@ -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;

View File

@@ -3,4 +3,7 @@
* Infrastructure implementations of repeat callback concerns.
* </p>
*/
package org.springframework.batch.repeat.callback;
@NonNullApi
package org.springframework.batch.repeat.callback;
import org.springframework.lang.NonNullApi;

View File

@@ -3,4 +3,7 @@
* Infrastructure implementations of repeat context concerns.
* </p>
*/
package org.springframework.batch.repeat.context;
@NonNullApi
package org.springframework.batch.repeat.context;
import org.springframework.lang.NonNullApi;

View File

@@ -3,4 +3,7 @@
* Infrastructure implementations of repeat exception handler concerns.
* </p>
*/
package org.springframework.batch.repeat.exception;
@NonNullApi
package org.springframework.batch.repeat.exception;
import org.springframework.lang.NonNullApi;

View File

@@ -3,4 +3,7 @@
* Infrastructure implementations of repeat aop concerns.
* </p>
*/
package org.springframework.batch.repeat.interceptor;
@NonNullApi
package org.springframework.batch.repeat.interceptor;
import org.springframework.lang.NonNullApi;

View File

@@ -3,4 +3,7 @@
* Infrastructure implementations of repeat interceptor concerns.
* </p>
*/
package org.springframework.batch.repeat.listener;
@NonNullApi
package org.springframework.batch.repeat.listener;
import org.springframework.lang.NonNullApi;

View File

@@ -3,4 +3,7 @@
* Infrastructure implementations of repeat concerns.
* </p>
*/
package org.springframework.batch.repeat;
@NonNullApi
package org.springframework.batch.repeat;
import org.springframework.lang.NonNullApi;

View File

@@ -3,4 +3,7 @@
* Infrastructure implementations of repeat policy concerns.
* </p>
*/
package org.springframework.batch.repeat.policy;
@NonNullApi
package org.springframework.batch.repeat.policy;
import org.springframework.lang.NonNullApi;

View File

@@ -3,4 +3,7 @@
* Infrastructure implementations of repeat support concerns.
* </p>
*/
package org.springframework.batch.repeat.support;
@NonNullApi
package org.springframework.batch.repeat.support;
import org.springframework.lang.NonNullApi;

View File

@@ -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);
}

View File

@@ -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);
}

View File

@@ -3,4 +3,7 @@
* Infrastructure implementations of support concerns.
* </p>
*/
package org.springframework.batch.support;
@NonNullApi
package org.springframework.batch.support;
import org.springframework.lang.NonNullApi;

View File

@@ -3,4 +3,7 @@
* Infrastructure implementations of support transaction concerns.
* </p>
*/
package org.springframework.batch.support.transaction;
@NonNullApi
package org.springframework.batch.support.transaction;
import org.springframework.lang.NonNullApi;