diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/ItemProcessListener.java b/spring-batch-core/src/main/java/org/springframework/batch/core/ItemProcessListener.java index 544ec5e5f..dbb79421e 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/ItemProcessListener.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/ItemProcessListener.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,7 @@ package org.springframework.batch.core; import org.springframework.batch.item.ItemProcessor; +import org.springframework.lang.Nullable; /** * Listener interface for the processing of an item. Implementations @@ -24,6 +25,7 @@ import org.springframework.batch.item.ItemProcessor; * exceptions thrown by the processor. * * @author Dave Syer + * @author Mahmoud Ben Hassine * */ public interface ItemProcessListener extends StepListener { @@ -37,13 +39,13 @@ public interface ItemProcessListener extends StepListener { /** * Called after {@link ItemProcessor#process(Object)} returns. If the - * processor returns null, this method will still be called, with - * a null result, allowing for notification of 'filtered' items. + * processor returns {@code null}, this method will still be called, with + * a {code null} result, allowing for notification of 'filtered' items. * * @param item to be processed * @param result of processing */ - void afterProcess(T item, S result); + void afterProcess(T item, @Nullable S result); /** * Called if an exception was thrown from {@link ItemProcessor#process(Object)}. diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/ItemReadListener.java b/spring-batch-core/src/main/java/org/springframework/batch/core/ItemReadListener.java index 72ff04c87..b96214685 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/ItemReadListener.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/ItemReadListener.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2008 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,11 +17,13 @@ package org.springframework.batch.core; import org.springframework.batch.item.ItemReader; import org.springframework.batch.item.ItemWriter; +import org.springframework.lang.Nullable; /** * Listener interface around the reading of an item. * * @author Lucas Ward + * @author Mahmoud Ben Hassine * */ public interface ItemReadListener extends StepListener { @@ -36,7 +38,7 @@ public interface ItemReadListener extends StepListener { * * @param item returned from read() */ - void afterRead(T item); + void afterRead(@Nullable T item); /** * Called if an error occurs while trying to read. diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/Job.java b/spring-batch-core/src/main/java/org/springframework/batch/core/Job.java index f6c5cafaf..b080127e6 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/Job.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/Job.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. @@ -15,6 +15,8 @@ */ package org.springframework.batch.core; +import org.springframework.lang.Nullable; + /** * Batch domain object representing a job. Job is an explicit abstraction * representing the configuration of a job specified by a developer. It should @@ -22,7 +24,7 @@ package org.springframework.batch.core; * step. * * @author Dave Syer - * + * @author Mahmoud Ben Hassine */ public interface Job { @@ -47,11 +49,12 @@ public interface Job { /** * If clients need to generate new parameters for the next execution in a - * sequence they can use this incrementer. The return value may be null, in - * the case that this job does not have a natural sequence. + * sequence they can use this incrementer. The return value may be {@code null}, + * in the case that this job does not have a natural sequence. * * @return in incrementer to be used for creating new parameters */ + @Nullable JobParametersIncrementer getJobParametersIncrementer(); /** @@ -60,8 +63,8 @@ public interface Job { * the execution. * * @return a validator that can be used to check parameter values (never - * null) + * {@code null}) */ JobParametersValidator getJobParametersValidator(); -} \ No newline at end of file +} diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/JobExecution.java b/spring-batch-core/src/main/java/org/springframework/batch/core/JobExecution.java index 54799e281..0aeb021ac 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/JobExecution.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/JobExecution.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. @@ -29,12 +29,14 @@ import java.util.Set; import java.util.concurrent.CopyOnWriteArrayList; import org.springframework.batch.item.ExecutionContext; +import org.springframework.lang.Nullable; /** * Batch domain object representing the execution of a job. * * @author Lucas Ward * @author Michael Minella + * @author Mahmoud Ben Hassine * */ @SuppressWarnings("serial") @@ -91,7 +93,7 @@ public class JobExecution extends Entity { * @param jobConfigurationName {@link String} instance that represents the * job configuration name (used with JSR-352). */ - public JobExecution(JobInstance job, Long id, JobParameters jobParameters, String jobConfigurationName) { + public JobExecution(JobInstance job, Long id, @Nullable JobParameters jobParameters, String jobConfigurationName) { super(id); this.jobInstance = job; this.jobParameters = jobParameters == null ? new JobParameters() : jobParameters; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/JobKeyGenerator.java b/spring-batch-core/src/main/java/org/springframework/batch/core/JobKeyGenerator.java index 54e0ba200..eede44288 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/JobKeyGenerator.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/JobKeyGenerator.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2013 the original author or authors. + * Copyright 2013-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,11 +15,14 @@ */ package org.springframework.batch.core; +import org.springframework.lang.Nullable; + /** * Strategy interface for the generation of the key used in identifying * unique {@link JobInstance}. * * @author Michael Minella + * @author Mahmoud Ben Hassine * * @param The type of the source data used to calculate the key. * @since 2.2 @@ -29,10 +32,10 @@ public interface JobKeyGenerator { /** * Method to generate the unique key used to identify a job instance. * - * @param source Source information used to generate the key + * @param source Source information used to generate the key (can be {@code null}) * * @return a unique string identifying the job based on the information * supplied */ - String generateKey(T source); + String generateKey(@Nullable T source); } diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/JobParametersIncrementer.java b/spring-batch-core/src/main/java/org/springframework/batch/core/JobParametersIncrementer.java index be86243bc..da4265542 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/JobParametersIncrementer.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/JobParametersIncrementer.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. @@ -15,11 +15,14 @@ */ package org.springframework.batch.core; +import org.springframework.lang.Nullable; + /** * Interface for obtaining the next {@link JobParameters} in a sequence. * * @author Dave Syer * @author Lucas Ward + * @author Mahmoud Ben Hassine * @since 2.0 */ public interface JobParametersIncrementer { @@ -30,8 +33,8 @@ public interface JobParametersIncrementer { * instance of a job. * * @param parameters the last value used - * @return the next value to use + * @return the next value to use (never {@code null}) */ - JobParameters getNext(JobParameters parameters); + JobParameters getNext(@Nullable JobParameters parameters); } diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/JobParametersValidator.java b/spring-batch-core/src/main/java/org/springframework/batch/core/JobParametersValidator.java index 730916f60..3ff5f86a8 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/JobParametersValidator.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/JobParametersValidator.java @@ -1,5 +1,5 @@ /* - * Copyright 2010 the original author or authors. + * Copyright 2010-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,13 +15,15 @@ */ package org.springframework.batch.core; +import org.springframework.lang.Nullable; /** * Strategy interface for a {@link Job} to use in validating its parameters for * an execution. * * @author Dave Syer - * + * @author Mahmoud Ben Hassine + * */ public interface JobParametersValidator { @@ -29,9 +31,9 @@ public interface JobParametersValidator { * Check the parameters meet whatever requirements are appropriate, and * throw an exception if not. * - * @param parameters some {@link JobParameters} + * @param parameters some {@link JobParameters} (can be {@code null}) * @throws JobParametersInvalidException if the parameters are invalid */ - void validate(JobParameters parameters) throws JobParametersInvalidException; + void validate(@Nullable JobParameters parameters) throws JobParametersInvalidException; } diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/StepExecutionListener.java b/spring-batch-core/src/main/java/org/springframework/batch/core/StepExecutionListener.java index 44ad32bdb..ee6e2acef 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/StepExecutionListener.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/StepExecutionListener.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. @@ -15,12 +15,14 @@ */ package org.springframework.batch.core; +import org.springframework.lang.Nullable; /** * Listener interface for the lifecycle of a {@link Step}. * * @author Lucas Ward * @author Dave Syer + * @author Mahmoud Ben Hassine * */ public interface StepExecutionListener extends StepListener { @@ -44,7 +46,8 @@ public interface StepExecutionListener extends StepListener { * * @param stepExecution {@link StepExecution} instance. * @return an {@link ExitStatus} to combine with the normal value. Return - * null to leave the old value unchanged. + * {@code null} to leave the old value unchanged. */ + @Nullable ExitStatus afterStep(StepExecution stepExecution); } diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/JobLocator.java b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/JobLocator.java index a7e6f9f83..7887cea1f 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/JobLocator.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/JobLocator.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,14 @@ package org.springframework.batch.core.configuration; import org.springframework.batch.core.Job; import org.springframework.batch.core.launch.NoSuchJobException; +import org.springframework.lang.Nullable; /** * A runtime service locator interface for retrieving job configurations by * name. * * @author Dave Syer + * @author Mahmoud Ben Hassine * */ public interface JobLocator { @@ -37,5 +39,5 @@ public interface JobLocator { * @throws NoSuchJobException if the required configuration can * not be found. */ - Job getJob(String name) throws NoSuchJobException; + Job getJob(@Nullable String name) throws NoSuchJobException; } diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/annotation/package-info.java b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/annotation/package-info.java index bdff91cd4..6b876be28 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/annotation/package-info.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/annotation/package-info.java @@ -2,5 +2,9 @@ * Annotations and builder factories for java based configuration * * @author Michael Minella + * @author Mahmoud Ben Hassine */ -package org.springframework.batch.core.configuration.annotation; \ No newline at end of file +@NonNullApi +package org.springframework.batch.core.configuration.annotation; + +import org.springframework.lang.NonNullApi; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/package-info.java b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/package-info.java index 41c459857..95c8411ba 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/package-info.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/package-info.java @@ -2,5 +2,9 @@ * Interfaces for registration and location of job configurations. * * @author Michael Minella + * @author Mahmoud Ben Hassine */ -package org.springframework.batch.core.configuration; \ No newline at end of file +@NonNullApi +package org.springframework.batch.core.configuration; + +import org.springframework.lang.NonNullApi; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/support/DefaultJobLoader.java b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/support/DefaultJobLoader.java index 39b34cdfb..40942d3ed 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/support/DefaultJobLoader.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/support/DefaultJobLoader.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. @@ -35,6 +35,7 @@ import org.springframework.batch.core.step.StepLocator; import org.springframework.beans.factory.InitializingBean; import org.springframework.context.ApplicationContext; import org.springframework.context.ConfigurableApplicationContext; +import org.springframework.lang.Nullable; import org.springframework.util.Assert; /** @@ -45,6 +46,7 @@ import org.springframework.util.Assert; * * @author Dave Syer * @author Stephane Nicoll + * @author Mahmoud Ben Hassine */ public class DefaultJobLoader implements JobLoader, InitializingBean { @@ -77,9 +79,9 @@ public class DefaultJobLoader implements JobLoader, InitializingBean { * Creates a job loader with the job and step registries provided. * * @param jobRegistry a {@link JobRegistry} - * @param stepRegistry a {@link StepRegistry} + * @param stepRegistry a {@link StepRegistry} (can be {@code null}) */ - public DefaultJobLoader(JobRegistry jobRegistry, StepRegistry stepRegistry) { + public DefaultJobLoader(JobRegistry jobRegistry, @Nullable StepRegistry stepRegistry) { this.jobRegistry = jobRegistry; this.stepRegistry = stepRegistry; } diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/support/GroupAwareJob.java b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/support/GroupAwareJob.java index be40fc985..88beaea7e 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/support/GroupAwareJob.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/support/GroupAwareJob.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. @@ -19,6 +19,7 @@ import org.springframework.batch.core.Job; import org.springframework.batch.core.JobExecution; import org.springframework.batch.core.JobParametersIncrementer; import org.springframework.batch.core.JobParametersValidator; +import org.springframework.lang.Nullable; import org.springframework.util.ClassUtils; /** @@ -32,6 +33,7 @@ import org.springframework.util.ClassUtils; * * * @author Dave Syer + * @author Mahmoud Ben Hassine * */ public class GroupAwareJob implements Job { @@ -58,10 +60,10 @@ public class GroupAwareJob implements Job { /** * Create a new {@link Job} with the given group name and delegate. * - * @param groupName the group name to prepend + * @param groupName the group name to prepend (can be {@code null}) * @param delegate a delegate for the features of a regular Job */ - public GroupAwareJob(String groupName, Job delegate) { + public GroupAwareJob(@Nullable String groupName, Job delegate) { super(); this.groupName = groupName; this.delegate = delegate; @@ -89,6 +91,7 @@ public class GroupAwareJob implements Job { } @Override + @Nullable public JobParametersIncrementer getJobParametersIncrementer() { return delegate.getJobParametersIncrementer(); } diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/support/MapJobRegistry.java b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/support/MapJobRegistry.java index 6ab89d675..acb85f6a1 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/support/MapJobRegistry.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/support/MapJobRegistry.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. @@ -25,6 +25,7 @@ import org.springframework.batch.core.configuration.DuplicateJobException; import org.springframework.batch.core.configuration.JobFactory; import org.springframework.batch.core.configuration.JobRegistry; import org.springframework.batch.core.launch.NoSuchJobException; +import org.springframework.lang.Nullable; import org.springframework.util.Assert; /** @@ -32,6 +33,7 @@ import org.springframework.util.Assert; * * @author Dave Syer * @author Robert Fischer + * @author Mahmoud Ben Hassine */ public class MapJobRegistry implements JobRegistry { @@ -60,7 +62,7 @@ public class MapJobRegistry implements JobRegistry { } @Override - public Job getJob(String name) throws NoSuchJobException { + public Job getJob(@Nullable String name) throws NoSuchJobException { JobFactory factory = map.get(name); if (factory == null) { throw new NoSuchJobException("No job configuration with the name [" + name + "] was registered"); diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/support/package-info.java b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/support/package-info.java index 96ca6d0b6..ba3ed7599 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/support/package-info.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/support/package-info.java @@ -2,5 +2,9 @@ * Specific implementations of configuration concerns. * * @author Michael Minella + * @author Mahmoud Ben Hassine */ -package org.springframework.batch.core.configuration.support; \ No newline at end of file +@NonNullApi +package org.springframework.batch.core.configuration.support; + +import org.springframework.lang.NonNullApi; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/package-info.java b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/package-info.java index 4f66d82c9..06d7e9634 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/package-info.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/package-info.java @@ -2,5 +2,9 @@ * Parsers for XML based configuration * * @author Michael Minella + * @author Mahmoud Ben Hassine */ -package org.springframework.batch.core.configuration.xml; \ No newline at end of file +@NonNullApi +package org.springframework.batch.core.configuration.xml; + +import org.springframework.lang.NonNullApi; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/converter/DefaultJobParametersConverter.java b/spring-batch-core/src/main/java/org/springframework/batch/core/converter/DefaultJobParametersConverter.java index 1a2d953a7..972f98483 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/converter/DefaultJobParametersConverter.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/converter/DefaultJobParametersConverter.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2014 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. @@ -20,6 +20,7 @@ import org.springframework.batch.core.JobParameter; import org.springframework.batch.core.JobParameter.ParameterType; import org.springframework.batch.core.JobParameters; import org.springframework.batch.core.JobParametersBuilder; +import org.springframework.lang.Nullable; import org.springframework.util.StringUtils; import java.text.DateFormat; @@ -58,6 +59,7 @@ import java.util.Properties; * * @author Dave Syer * @author Michael Minella + * @author Mahmoud Ben Hassine * */ public class DefaultJobParametersConverter implements JobParametersConverter { @@ -92,7 +94,7 @@ public class DefaultJobParametersConverter implements JobParametersConverter { * @see org.springframework.batch.core.converter.JobParametersConverter#getJobParameters(java.util.Properties) */ @Override - public JobParameters getJobParameters(Properties props) { + public JobParameters getJobParameters(@Nullable Properties props) { if (props == null || props.isEmpty()) { return new JobParameters(); @@ -188,7 +190,7 @@ public class DefaultJobParametersConverter implements JobParametersConverter { * @see org.springframework.batch.core.converter.JobParametersConverter#getProperties(org.springframework.batch.core.JobParameters) */ @Override - public Properties getProperties(JobParameters params) { + public Properties getProperties(@Nullable JobParameters params) { if (params == null || params.isEmpty()) { return new Properties(); diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/converter/JobParametersConverter.java b/spring-batch-core/src/main/java/org/springframework/batch/core/converter/JobParametersConverter.java index 42bd308a6..0b59399b5 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/converter/JobParametersConverter.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/converter/JobParametersConverter.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. @@ -20,6 +20,7 @@ import java.util.Properties; import org.springframework.batch.core.JobParameters; import org.springframework.batch.core.JobParametersBuilder; +import org.springframework.lang.Nullable; /** * A factory for {@link JobParameters} instances. A job can be executed with @@ -27,6 +28,7 @@ import org.springframework.batch.core.JobParametersBuilder; * This converter allows job parameters to be converted to and from Properties. * * @author Dave Syer + * @author Mahmoud Ben Hassine * * @see JobParametersBuilder * @@ -41,7 +43,7 @@ public interface JobParametersConverter { * @return a {@link JobParameters} properties converted to the correct * types. */ - public JobParameters getJobParameters(Properties properties); + JobParameters getJobParameters(@Nullable Properties properties); /** * The inverse operation: get a {@link Properties} instance. If given null @@ -50,5 +52,5 @@ public interface JobParametersConverter { * @param params the {@link JobParameters} instance to be converted. * @return a representation of the parameters as properties */ - public Properties getProperties(JobParameters params); + Properties getProperties(@Nullable JobParameters params); } diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/converter/package-info.java b/spring-batch-core/src/main/java/org/springframework/batch/core/converter/package-info.java index d4a504ced..3330b0f30 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/converter/package-info.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/converter/package-info.java @@ -3,5 +3,9 @@ * concerns. * * @author Michael Minella + * @author Mahmoud Ben Hassine */ -package org.springframework.batch.core.converter; \ No newline at end of file +@NonNullApi +package org.springframework.batch.core.converter; + +import org.springframework.lang.NonNullApi; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/explore/JobExplorer.java b/spring-batch-core/src/main/java/org/springframework/batch/core/explore/JobExplorer.java index 115f36959..f03155e06 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/explore/JobExplorer.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/explore/JobExplorer.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. @@ -23,6 +23,7 @@ import org.springframework.batch.core.JobInstance; import org.springframework.batch.core.StepExecution; import org.springframework.batch.core.launch.NoSuchJobException; import org.springframework.batch.item.ExecutionContext; +import org.springframework.lang.Nullable; /** * Entry point for browsing executions of running or historical jobs and steps. @@ -32,6 +33,7 @@ import org.springframework.batch.item.ExecutionContext; * @author Dave Syer * @author Michael Minella * @author Will Schipp + * @author Mahmoud Ben Hassine * @since 2.0 */ public interface JobExplorer { @@ -57,7 +59,8 @@ public interface JobExplorer { * @param executionId the job execution id * @return the {@link JobExecution} with this id, or null if not found */ - JobExecution getJobExecution(Long executionId); + @Nullable + JobExecution getJobExecution(@Nullable Long executionId); /** * Retrieve a {@link StepExecution} by its id and parent @@ -71,13 +74,15 @@ public interface JobExplorer { * * @see #getJobExecution(Long) */ - StepExecution getStepExecution(Long jobExecutionId, Long stepExecutionId); + @Nullable + StepExecution getStepExecution(@Nullable Long jobExecutionId, @Nullable Long stepExecutionId); /** * @param instanceId {@link Long} id for the jobInstance to obtain. * @return the {@link JobInstance} with this id, or null */ - JobInstance getJobInstance(Long instanceId); + @Nullable + JobInstance getJobInstance(@Nullable Long instanceId); /** * Retrieve job executions by their job instance. The corresponding step @@ -99,7 +104,7 @@ public interface JobExplorer { * @param jobName the name of the job * @return the set of running executions for jobs with the specified name */ - Set findRunningJobExecutions(String jobName); + Set findRunningJobExecutions(@Nullable String jobName); /** * Query the repository for all unique {@link JobInstance} names (sorted @@ -131,6 +136,6 @@ public interface JobExplorer { * @throws NoSuchJobException thrown when there is no {@link JobInstance} * for the jobName specified. */ - int getJobInstanceCount(String jobName) throws NoSuchJobException; + int getJobInstanceCount(@Nullable String jobName) throws NoSuchJobException; } diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/explore/package-info.java b/spring-batch-core/src/main/java/org/springframework/batch/core/explore/package-info.java index 27a8fb739..b5671f50b 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/explore/package-info.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/explore/package-info.java @@ -2,5 +2,9 @@ * Interfaces and related classes to support meta data browsing. * * @author Michael Minella + * @author Mahmoud Ben Hassine */ -package org.springframework.batch.core.explore; \ No newline at end of file +@NonNullApi +package org.springframework.batch.core.explore; + +import org.springframework.lang.NonNullApi; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/explore/support/SimpleJobExplorer.java b/spring-batch-core/src/main/java/org/springframework/batch/core/explore/support/SimpleJobExplorer.java index c16b8f7e2..dd8072d25 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/explore/support/SimpleJobExplorer.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/explore/support/SimpleJobExplorer.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. @@ -25,6 +25,7 @@ import org.springframework.batch.core.repository.dao.ExecutionContextDao; import org.springframework.batch.core.repository.dao.JobExecutionDao; import org.springframework.batch.core.repository.dao.JobInstanceDao; import org.springframework.batch.core.repository.dao.StepExecutionDao; +import org.springframework.lang.Nullable; import java.util.List; import java.util.Set; @@ -36,6 +37,7 @@ import java.util.Set; * @author Lucas Ward * @author Michael Minella * @author Will Schipp + * @author Mahmoud Ben Hassine * * @see JobExplorer * @see JobInstanceDao @@ -157,7 +159,7 @@ public class SimpleJobExplorer implements JobExplorer { * .lang.Long) */ @Override - public JobInstance getJobInstance(Long instanceId) { + public JobInstance getJobInstance(@Nullable Long instanceId) { return jobInstanceDao.getJobInstance(instanceId); } @@ -187,7 +189,7 @@ public class SimpleJobExplorer implements JobExplorer { * @see org.springframework.batch.core.explore.JobExplorer#getJobInstanceCount(java.lang.String) */ @Override - public int getJobInstanceCount(String jobName) throws NoSuchJobException { + public int getJobInstanceCount(@Nullable String jobName) throws NoSuchJobException { return jobInstanceDao.getJobInstanceCount(jobName); } diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/explore/support/package-info.java b/spring-batch-core/src/main/java/org/springframework/batch/core/explore/support/package-info.java index 88b776115..6150d736c 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/explore/support/package-info.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/explore/support/package-info.java @@ -2,5 +2,9 @@ * Specific implementations of explorer concerns. * * @author Michael Minella + * @author Mahmoud Ben Hassine */ -package org.springframework.batch.core.explore.support; \ No newline at end of file +@NonNullApi +package org.springframework.batch.core.explore.support; + +import org.springframework.lang.NonNullApi; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/job/AbstractJob.java b/spring-batch-core/src/main/java/org/springframework/batch/core/job/AbstractJob.java index b6fc49b4e..8be39ed09 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/job/AbstractJob.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/job/AbstractJob.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2014 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. @@ -43,6 +43,7 @@ import org.springframework.batch.core.step.StepLocator; import org.springframework.batch.repeat.RepeatException; import org.springframework.beans.factory.BeanNameAware; import org.springframework.beans.factory.InitializingBean; +import org.springframework.lang.Nullable; import org.springframework.util.Assert; import org.springframework.util.ClassUtils; @@ -54,6 +55,7 @@ import org.springframework.util.ClassUtils; * * @author Lucas Ward * @author Dave Syer + * @author Mahmoud Ben Hassine */ public abstract class AbstractJob implements Job, StepLocator, BeanNameAware, InitializingBean { @@ -211,6 +213,7 @@ InitializingBean { * @see org.springframework.batch.core.Job#getJobParametersIncrementer() */ @Override + @Nullable public JobParametersIncrementer getJobParametersIncrementer() { return this.jobParametersIncrementer; } @@ -287,6 +290,8 @@ InitializingBean { @Override public final void execute(JobExecution execution) { + Assert.notNull(execution, "jobExecution must not be null"); + if (logger.isDebugEnabled()) { logger.debug("Job execution starting: " + execution); } diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/job/CompositeJobParametersValidator.java b/spring-batch-core/src/main/java/org/springframework/batch/core/job/CompositeJobParametersValidator.java index 72673442d..63275c9af 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/job/CompositeJobParametersValidator.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/job/CompositeJobParametersValidator.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2013 the original author or authors. + * Copyright 2011-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.core.JobParameters; import org.springframework.batch.core.JobParametersInvalidException; import org.springframework.batch.core.JobParametersValidator; import org.springframework.beans.factory.InitializingBean; +import org.springframework.lang.Nullable; import org.springframework.util.Assert; /** @@ -28,6 +29,7 @@ import org.springframework.util.Assert; * injected JobParametersValidators * * @author Morten Andersen-Gott + * @author Mahmoud Ben Hassine * */ public class CompositeJobParametersValidator implements JobParametersValidator, InitializingBean { @@ -42,7 +44,7 @@ public class CompositeJobParametersValidator implements JobParametersValidator, * @throws JobParametersInvalidException if the parameters are invalid */ @Override - public void validate(JobParameters parameters) throws JobParametersInvalidException { + public void validate(@Nullable JobParameters parameters) throws JobParametersInvalidException { for (JobParametersValidator validator : validators) { validator.validate(parameters); } diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/job/DefaultJobParametersValidator.java b/spring-batch-core/src/main/java/org/springframework/batch/core/job/DefaultJobParametersValidator.java index 2e81f4731..dce0e4d68 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/job/DefaultJobParametersValidator.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/job/DefaultJobParametersValidator.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2013 the original author or authors. + * Copyright 2012-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. @@ -24,12 +24,14 @@ import org.springframework.batch.core.JobParameters; import org.springframework.batch.core.JobParametersInvalidException; import org.springframework.batch.core.JobParametersValidator; import org.springframework.beans.factory.InitializingBean; +import org.springframework.lang.Nullable; import org.springframework.util.Assert; /** * Default implementation of {@link JobParametersValidator}. * * @author Dave Syer + * @author Mahmoud Ben Hassine * */ public class DefaultJobParametersValidator implements JobParametersValidator, InitializingBean { @@ -83,7 +85,7 @@ public class DefaultJobParametersValidator implements JobParametersValidator, In * @throws JobParametersInvalidException if the parameters are not valid */ @Override - public void validate(JobParameters parameters) throws JobParametersInvalidException { + public void validate(@Nullable JobParameters parameters) throws JobParametersInvalidException { if (parameters == null) { throw new JobParametersInvalidException("The JobParameters can not be null"); diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/job/builder/package-info.java b/spring-batch-core/src/main/java/org/springframework/batch/core/job/builder/package-info.java index 8f6190c87..8ebd881b8 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/job/builder/package-info.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/job/builder/package-info.java @@ -2,5 +2,9 @@ * Job and flow level builders for java based configuration of batch jobs * * @author Michael Minella + * @author Mahmoud Ben Hassine */ -package org.springframework.batch.core.job.builder; \ No newline at end of file +@NonNullApi +package org.springframework.batch.core.job.builder; + +import org.springframework.lang.NonNullApi; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/FlowExecutor.java b/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/FlowExecutor.java index a5f227290..5e60b8281 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/FlowExecutor.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/FlowExecutor.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. @@ -21,12 +21,14 @@ import org.springframework.batch.core.StartLimitExceededException; import org.springframework.batch.core.Step; import org.springframework.batch.core.StepExecution; import org.springframework.batch.core.repository.JobRestartException; +import org.springframework.lang.Nullable; /** * Context and execution strategy for {@link FlowJob} to allow it to delegate * its execution step by step. * * @author Dave Syer + * @author Mahmoud Ben Hassine * @since 2.0 */ public interface FlowExecutor { @@ -48,6 +50,7 @@ public interface FlowExecutor { /** * @return the latest {@link StepExecution} or null if there is none */ + @Nullable StepExecution getStepExecution(); /** diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/JobExecutionDecider.java b/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/JobExecutionDecider.java index e61e97d55..e6386c042 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/JobExecutionDecider.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/JobExecutionDecider.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,6 +17,7 @@ package org.springframework.batch.core.job.flow; import org.springframework.batch.core.JobExecution; import org.springframework.batch.core.StepExecution; +import org.springframework.lang.Nullable; /** * Interface allowing for programmatic access to the decision on what the status @@ -25,6 +26,7 @@ import org.springframework.batch.core.StepExecution; * implementation could check that value to determine the status of the flow. * * @author Dave Syer + * @author Mahmoud Ben Hassine * @since 2.0 */ public interface JobExecutionDecider { @@ -35,9 +37,9 @@ public interface JobExecutionDecider { * determine the next step in the job. * * @param jobExecution a job execution - * @param stepExecution the latest step execution (may be null) + * @param stepExecution the latest step execution (may be {@code null}) * @return the exit status code */ - FlowExecutionStatus decide(JobExecution jobExecution, StepExecution stepExecution); + FlowExecutionStatus decide(JobExecution jobExecution, @Nullable StepExecution stepExecution); } diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/JobFlowExecutor.java b/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/JobFlowExecutor.java index 45c70b750..8f06458f3 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/JobFlowExecutor.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/JobFlowExecutor.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. @@ -26,6 +26,7 @@ import org.springframework.batch.core.StepExecution; import org.springframework.batch.core.job.StepHandler; import org.springframework.batch.core.repository.JobRepository; import org.springframework.batch.core.repository.JobRestartException; +import org.springframework.lang.Nullable; /** * Implementation of {@link FlowExecutor} for use in components that need to @@ -33,6 +34,7 @@ import org.springframework.batch.core.repository.JobRestartException; * * @author Dave Syer * @author Michael Minella + * @author Mahmoud Ben Hassine * */ public class JobFlowExecutor implements FlowExecutor { @@ -108,6 +110,7 @@ public class JobFlowExecutor implements FlowExecutor { } @Override + @Nullable public StepExecution getStepExecution() { return stepExecutionHolder.get(); } diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/package-info.java b/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/package-info.java index 09763a929..f64efbb06 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/package-info.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/package-info.java @@ -2,5 +2,9 @@ * Flow related constructs including Flow interface, executors, and related exceptions * * @author Michael Minella + * @author Mahmoud Ben Hassine */ -package org.springframework.batch.core.job.flow; \ No newline at end of file +@NonNullApi +package org.springframework.batch.core.job.flow; + +import org.springframework.lang.NonNullApi; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/support/StateTransition.java b/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/support/StateTransition.java index 241286bd3..da09858c7 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/support/StateTransition.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/support/StateTransition.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. @@ -18,6 +18,7 @@ package org.springframework.batch.core.job.flow.support; import org.springframework.batch.core.ExitStatus; import org.springframework.batch.core.job.flow.State; import org.springframework.batch.support.PatternMatcher; +import org.springframework.lang.Nullable; import org.springframework.util.Assert; import org.springframework.util.StringUtils; @@ -29,6 +30,7 @@ import org.springframework.util.StringUtils; * * @author Dave Syer * @author Michael Minella + * @author Mahmoud Ben Hassine * @since 2.0 */ public final class StateTransition { @@ -108,15 +110,15 @@ public final class StateTransition { * @param state the {@link State} used to generate the outcome for this * transition * @param pattern the pattern to match in the exit status of the - * {@link State} - * @param next the name of the next {@link State} to execute + * {@link State} (can be {@code null}) + * @param next the name of the next {@link State} to execute (can be {@code null}) * @return {@link StateTransition} that was created. */ - public static StateTransition createStateTransition(State state, String pattern, String next) { + public static StateTransition createStateTransition(State state, @Nullable String pattern, @Nullable String next) { return new StateTransition(state, pattern, next); } - private StateTransition(State state, String pattern, String next) { + private StateTransition(State state, @Nullable String pattern, @Nullable String next) { super(); if (!StringUtils.hasText(pattern)) { this.pattern = "*"; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/support/package-info.java b/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/support/package-info.java index 767f5956d..3764d3be6 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/support/package-info.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/support/package-info.java @@ -2,5 +2,9 @@ * Basic implementations of flow constructs * * @author Michael Minella + * @author Mahmoud Ben Hassine */ -package org.springframework.batch.core.job.flow.support; \ No newline at end of file +@NonNullApi +package org.springframework.batch.core.job.flow.support; + +import org.springframework.lang.NonNullApi; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/support/state/package-info.java b/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/support/state/package-info.java index b8df3f9ed..4277ac4e9 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/support/state/package-info.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/support/state/package-info.java @@ -2,5 +2,9 @@ * States used in defining the underlying Spring Batch state machine * * @author Michael Minella + * @author Mahmoud Ben Hassine */ -package org.springframework.batch.core.job.flow.support.state; \ No newline at end of file +@NonNullApi +package org.springframework.batch.core.job.flow.support.state; + +import org.springframework.lang.NonNullApi; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/job/package-info.java b/spring-batch-core/src/main/java/org/springframework/batch/core/job/package-info.java index dee6142fc..a96f7e895 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/job/package-info.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/job/package-info.java @@ -2,5 +2,9 @@ * Specific implementations of job concerns. * * @author Michael Minella + * @author Mahmoud Ben Hassine */ -package org.springframework.batch.core.job; \ No newline at end of file +@NonNullApi +package org.springframework.batch.core.job; + +import org.springframework.lang.NonNullApi; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/ItemProcessListenerAdapter.java b/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/ItemProcessListenerAdapter.java index 5a514f270..6f51fda78 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/ItemProcessListenerAdapter.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/ItemProcessListenerAdapter.java @@ -1,5 +1,5 @@ /* - * Copyright 2013 the original author or authors. + * Copyright 2013-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,12 +18,14 @@ package org.springframework.batch.core.jsr; import javax.batch.operations.BatchRuntimeException; import org.springframework.batch.core.ItemProcessListener; +import org.springframework.lang.Nullable; import org.springframework.util.Assert; /** * Wrapper class for {@link javax.batch.api.chunk.listener.ItemProcessListener} * * @author Michael Minella + * @author Mahmoud Ben Hassine * * @param input type * @param output type @@ -51,7 +53,7 @@ public class ItemProcessListenerAdapter implements ItemProcessListener type to be returned via a read on the associated {@link ItemReader} * @since 3.0 @@ -49,7 +51,7 @@ public class ItemReadListenerAdapter implements ItemReadListener { } @Override - public void afterRead(T item) { + public void afterRead(@Nullable T item) { try { delegate.afterRead(item); } catch (Exception e) { diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/JsrJobContext.java b/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/JsrJobContext.java index e98104662..2dda24d44 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/JsrJobContext.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/JsrJobContext.java @@ -1,5 +1,5 @@ /* - * Copyright 2013 the original author or authors. + * Copyright 2013-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 javax.batch.runtime.BatchStatus; import org.springframework.batch.core.ExitStatus; import org.springframework.batch.core.JobExecution; +import org.springframework.lang.Nullable; import org.springframework.util.Assert; /** @@ -31,6 +32,7 @@ import org.springframework.util.Assert; * * @author Michael Minella * @author Chris Schaefer + * @author Mahmoud Ben Hassine * @since 3.0 */ public class JsrJobContext implements javax.batch.runtime.context.JobContext { @@ -44,7 +46,7 @@ public class JsrJobContext implements javax.batch.runtime.context.JobContext { this.jobExecution = jobExecution; } - public void setProperties(Properties properties) { + public void setProperties(@Nullable Properties properties) { this.properties = properties != null ? properties : new Properties(); } @@ -108,6 +110,7 @@ public class JsrJobContext implements javax.batch.runtime.context.JobContext { * @see javax.batch.runtime.context.JobContext#getExitStatus() */ @Override + @Nullable public String getExitStatus() { return exitStatusSet.get() ? jobExecution.getExitStatus().getExitCode() : null; } diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/JsrJobParametersConverter.java b/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/JsrJobParametersConverter.java index eea8260dd..b7a57d020 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/JsrJobParametersConverter.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/JsrJobParametersConverter.java @@ -1,5 +1,5 @@ /* - * Copyright 2013 the original author or authors. + * Copyright 2013-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. @@ -31,6 +31,7 @@ import org.springframework.batch.item.database.support.DefaultDataFieldMaxValueI import org.springframework.batch.support.DatabaseType; import org.springframework.beans.factory.InitializingBean; import org.springframework.jdbc.support.incrementer.DataFieldMaxValueIncrementer; +import org.springframework.lang.Nullable; import org.springframework.util.Assert; /** @@ -43,6 +44,7 @@ import org.springframework.util.Assert; * for BATCH_JOB_INSTANCE records. * * @author Michael Minella + * @author Mahmoud Ben Hassine * @since 3.0 */ public class JsrJobParametersConverter implements JobParametersConverter, InitializingBean { @@ -82,7 +84,7 @@ public class JsrJobParametersConverter implements JobParametersConverter, Initia * @see org.springframework.batch.core.converter.JobParametersConverter#getJobParameters(java.util.Properties) */ @Override - public JobParameters getJobParameters(Properties properties) { + public JobParameters getJobParameters(@Nullable Properties properties) { JobParametersBuilder builder = new JobParametersBuilder(); boolean runIdFound = false; @@ -110,7 +112,7 @@ public class JsrJobParametersConverter implements JobParametersConverter, Initia * @see org.springframework.batch.core.converter.JobParametersConverter#getProperties(org.springframework.batch.core.JobParameters) */ @Override - public Properties getProperties(JobParameters params) { + public Properties getProperties(@Nullable JobParameters params) { Properties properties = new Properties(); boolean runIdFound = false; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/configuration/support/package-info.java b/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/configuration/support/package-info.java index cef532674..bd359dd44 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/configuration/support/package-info.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/configuration/support/package-info.java @@ -2,5 +2,9 @@ * Extensions of Spring components to support JSR-352 functionality. * * @author Michael Minella + * @author Mahmoud Ben Hassine */ -package org.springframework.batch.core.jsr.configuration.support; \ No newline at end of file +@NonNullApi +package org.springframework.batch.core.jsr.configuration.support; + +import org.springframework.lang.NonNullApi; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/configuration/xml/package-info.java b/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/configuration/xml/package-info.java index b23012081..582712ada 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/configuration/xml/package-info.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/configuration/xml/package-info.java @@ -2,5 +2,9 @@ * XML parsers for JSR-352 based Job Specification Language (JSL). * * @author Michael Minella + * @author Mahmoud Ben Hassine */ -package org.springframework.batch.core.jsr.configuration.xml; \ No newline at end of file +@NonNullApi +package org.springframework.batch.core.jsr.configuration.xml; + +import org.springframework.lang.NonNullApi; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/job/flow/package-info.java b/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/job/flow/package-info.java index e56669cb8..e40bd8b74 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/job/flow/package-info.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/job/flow/package-info.java @@ -2,5 +2,9 @@ * JSR-352 specific extensions of Flow constructs (executor and job). * * @author Michael Minella + * @author Mahmoud Ben Hassine */ -package org.springframework.batch.core.jsr.job.flow; \ No newline at end of file +@NonNullApi +package org.springframework.batch.core.jsr.job.flow; + +import org.springframework.lang.NonNullApi; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/job/flow/support/JsrFlow.java b/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/job/flow/support/JsrFlow.java index 226c9a411..1c9efbd57 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/job/flow/support/JsrFlow.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/job/flow/support/JsrFlow.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2014 the original author or authors. + * Copyright 2013-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. @@ -28,6 +28,7 @@ import org.springframework.batch.core.job.flow.support.SimpleFlow; import org.springframework.batch.core.job.flow.support.StateTransition; import org.springframework.batch.core.jsr.job.flow.support.state.JsrStepState; import org.springframework.batch.item.ExecutionContext; +import org.springframework.lang.Nullable; import org.springframework.util.StringUtils; /** @@ -38,6 +39,7 @@ import org.springframework.util.StringUtils; * attempts fail, the flow will fail due to the inability to find the next state. * * @author Michael Minella + * @author Mahmoud Ben Hassine * @since 3.0 */ public class JsrFlow extends SimpleFlow { @@ -51,6 +53,7 @@ public class JsrFlow extends SimpleFlow { super(name); } + @Nullable public String getMostRecentStepName() { if(currentStep != null) { return currentStep.getStep().getName(); diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/job/flow/support/package-info.java b/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/job/flow/support/package-info.java index 10e3df393..b91977971 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/job/flow/support/package-info.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/job/flow/support/package-info.java @@ -2,5 +2,9 @@ * JSR-352 specific flow extensions. * * @author Michael Minella + * @author Mahmoud Ben Hassine */ -package org.springframework.batch.core.jsr.job.flow.support; \ No newline at end of file +@NonNullApi +package org.springframework.batch.core.jsr.job.flow.support; + +import org.springframework.lang.NonNullApi; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/job/flow/support/state/package-info.java b/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/job/flow/support/state/package-info.java index fcf0bd840..4335b22ea 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/job/flow/support/state/package-info.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/job/flow/support/state/package-info.java @@ -2,5 +2,9 @@ * JSR-352 specific states used in flow execution. * * @author Michael Minella + * @author Mahmoud Ben Hassine */ -package org.springframework.batch.core.jsr.job.flow.support.state; \ No newline at end of file +@NonNullApi +package org.springframework.batch.core.jsr.job.flow.support.state; + +import org.springframework.lang.NonNullApi; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/job/package-info.java b/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/job/package-info.java index cc81ea2ca..7592416e9 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/job/package-info.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/job/package-info.java @@ -2,5 +2,9 @@ * JSR-352 specific handler implementations. * * @author Michael Minella + * @author Mahmoud Ben Hassine */ -package org.springframework.batch.core.jsr.job; \ No newline at end of file +@NonNullApi +package org.springframework.batch.core.jsr.job; + +import org.springframework.lang.NonNullApi; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/launch/package-info.java b/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/launch/package-info.java index 39b54c34d..00f60e37a 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/launch/package-info.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/launch/package-info.java @@ -2,5 +2,9 @@ * Implementation of the JSR-352 specific job launching facilities. * * @author Michael Minella + * @author Mahmoud Ben Hassine */ -package org.springframework.batch.core.jsr.launch; \ No newline at end of file +@NonNullApi +package org.springframework.batch.core.jsr.launch; + +import org.springframework.lang.NonNullApi; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/package-info.java b/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/package-info.java index 11c6dbbf0..45b3edde3 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/package-info.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/package-info.java @@ -2,5 +2,9 @@ * Extensions of core batch components to apply JSR-352 specific logic. * * @author Michael Minella + * @author Mahmoud Ben Hassine */ -package org.springframework.batch.core.jsr; \ No newline at end of file +@NonNullApi +package org.springframework.batch.core.jsr; + +import org.springframework.lang.NonNullApi; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/partition/package-info.java b/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/partition/package-info.java index 2f3389524..7ab8ea49e 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/partition/package-info.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/partition/package-info.java @@ -2,5 +2,9 @@ * Implementation of JSR-352 specific partitioning extensions. * * @author Michael Minella + * @author Mahmoud Ben Hassine */ -package org.springframework.batch.core.jsr.partition; \ No newline at end of file +@NonNullApi +package org.springframework.batch.core.jsr.partition; + +import org.springframework.lang.NonNullApi; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/partition/support/package-info.java b/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/partition/support/package-info.java new file mode 100644 index 000000000..6d0086f69 --- /dev/null +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/partition/support/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. + */ + +/** + * Support classes for JSR-352 partitioning configuration. + * + * @author Mahmoud Ben Hassine + */ +@NonNullApi +package org.springframework.batch.core.jsr.partition.support; + +import org.springframework.lang.NonNullApi; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/step/batchlet/package-info.java b/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/step/batchlet/package-info.java index d3e6c16a3..b97f3ed73 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/step/batchlet/package-info.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/step/batchlet/package-info.java @@ -2,5 +2,9 @@ * Classes for supporting JSR-352's {@link javax.batch.api.Batchlet}. * * @author Michael Minella + * @author Mahmoud Ben Hassine */ -package org.springframework.batch.core.jsr.step.batchlet; \ No newline at end of file +@NonNullApi +package org.springframework.batch.core.jsr.step.batchlet; + +import org.springframework.lang.NonNullApi; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/step/builder/package-info.java b/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/step/builder/package-info.java index 1efe54ec9..2dbcacea8 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/step/builder/package-info.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/step/builder/package-info.java @@ -2,5 +2,9 @@ * Extensions to step related builders to implement JSR-352 specific functionality * * @author Michael Minella + * @author Mahmoud Ben Hassine */ -package org.springframework.batch.core.jsr.step.builder; \ No newline at end of file +@NonNullApi +package org.springframework.batch.core.jsr.step.builder; + +import org.springframework.lang.NonNullApi; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/step/item/package-info.java b/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/step/item/package-info.java index 9196bd276..90ad4517a 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/step/item/package-info.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/step/item/package-info.java @@ -2,5 +2,9 @@ * JSR-352 specific components for implementing item based processing including fault tolerance. * * @author Michael Minella + * @author Mahmoud Ben Hassine */ -package org.springframework.batch.core.jsr.step.item; \ No newline at end of file +@NonNullApi +package org.springframework.batch.core.jsr.step.item; + +import org.springframework.lang.NonNullApi; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/step/package-info.java b/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/step/package-info.java index a0e7f8cf2..0fba98d0c 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/step/package-info.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/step/package-info.java @@ -2,5 +2,9 @@ * JSR-352 extensions of existing batch {@link org.springframework.batch.core.Step} types. * * @author Michael Minella + * @author Mahmoud Ben Hassine */ -package org.springframework.batch.core.jsr.step; \ No newline at end of file +@NonNullApi +package org.springframework.batch.core.jsr.step; + +import org.springframework.lang.NonNullApi; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/launch/package-info.java b/spring-batch-core/src/main/java/org/springframework/batch/core/launch/package-info.java index a05bbd7ac..0b629cc88 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/launch/package-info.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/launch/package-info.java @@ -2,5 +2,9 @@ * Interfaces and simple implementations of launch concerns. * * @author Michael Minella + * @author Mahmoud Ben Hassine */ -package org.springframework.batch.core.launch; \ No newline at end of file +@NonNullApi +package org.springframework.batch.core.launch; + +import org.springframework.lang.NonNullApi; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/RunIdIncrementer.java b/spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/RunIdIncrementer.java index 25abace0a..36b5a2c69 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/RunIdIncrementer.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/RunIdIncrementer.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. @@ -18,9 +18,11 @@ package org.springframework.batch.core.launch.support; import org.springframework.batch.core.JobParameters; import org.springframework.batch.core.JobParametersBuilder; import org.springframework.batch.core.JobParametersIncrementer; +import org.springframework.lang.Nullable; /** * @author Dave Syer + * @author Mahmoud Ben Hassine */ public class RunIdIncrementer implements JobParametersIncrementer { @@ -41,7 +43,7 @@ public class RunIdIncrementer implements JobParametersIncrementer { * Increment the run.id parameter (starting with 1). */ @Override - public JobParameters getNext(JobParameters parameters) { + public JobParameters getNext(@Nullable JobParameters parameters) { JobParameters params = (parameters == null) ? new JobParameters() : parameters; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/ScheduledJobParametersFactory.java b/spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/ScheduledJobParametersFactory.java index 520990817..943ec6e99 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/ScheduledJobParametersFactory.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/ScheduledJobParametersFactory.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. @@ -27,9 +27,11 @@ import org.springframework.batch.core.JobParameter; import org.springframework.batch.core.JobParameters; import org.springframework.batch.core.JobParametersBuilder; import org.springframework.batch.core.converter.JobParametersConverter; +import org.springframework.lang.Nullable; /** * @author Lucas Ward + * @author Mahmoud Ben Hassine * */ public class ScheduledJobParametersFactory implements JobParametersConverter { @@ -44,7 +46,7 @@ public class ScheduledJobParametersFactory implements JobParametersConverter { * @see org.springframework.batch.core.runtime.JobParametersFactory#getJobParameters(java.util.Properties) */ @Override - public JobParameters getJobParameters(Properties props) { + public JobParameters getJobParameters(@Nullable Properties props) { if (props == null || props.isEmpty()) { return new JobParameters(); @@ -75,7 +77,7 @@ public class ScheduledJobParametersFactory implements JobParametersConverter { * @see org.springframework.batch.core.converter.JobParametersConverter#getProperties(org.springframework.batch.core.JobParameters) */ @Override - public Properties getProperties(JobParameters params) { + public Properties getProperties(@Nullable JobParameters params) { if (params == null || params.isEmpty()) { return new Properties(); diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/package-info.java b/spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/package-info.java index 3ff35d572..8a468e015 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/package-info.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/package-info.java @@ -2,5 +2,9 @@ * Support classes for use in bootstrap and launch implementations or configurations. * * @author Michael Minella + * @author Mahmoud Ben Hassine */ -package org.springframework.batch.core.launch.support; \ No newline at end of file +@NonNullApi +package org.springframework.batch.core.launch.support; + +import org.springframework.lang.NonNullApi; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/listener/CompositeItemProcessListener.java b/spring-batch-core/src/main/java/org/springframework/batch/core/listener/CompositeItemProcessListener.java index a6124d68a..e658a9099 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/listener/CompositeItemProcessListener.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/listener/CompositeItemProcessListener.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. @@ -20,9 +20,11 @@ import java.util.List; import org.springframework.batch.core.ItemProcessListener; import org.springframework.core.Ordered; +import org.springframework.lang.Nullable; /** * @author Dave Syer + * @author Mahmoud Ben Hassine * */ public class CompositeItemProcessListener implements ItemProcessListener { @@ -54,7 +56,7 @@ public class CompositeItemProcessListener implements ItemProcessListener> iterator = listeners.reverse(); iterator.hasNext();) { ItemProcessListener listener = iterator.next(); listener.afterProcess(item, result); diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/listener/ItemListenerSupport.java b/spring-batch-core/src/main/java/org/springframework/batch/core/listener/ItemListenerSupport.java index 4b305a5b5..025988b2d 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/listener/ItemListenerSupport.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/listener/ItemListenerSupport.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. @@ -20,6 +20,7 @@ import java.util.List; import org.springframework.batch.core.ItemProcessListener; import org.springframework.batch.core.ItemReadListener; import org.springframework.batch.core.ItemWriteListener; +import org.springframework.lang.Nullable; /** * Basic no-op implementation of the {@link ItemReadListener}, @@ -28,6 +29,7 @@ import org.springframework.batch.core.ItemWriteListener; * at once. * * @author Lucas Ward + * @author Mahmoud Ben Hassine * */ public class ItemListenerSupport implements ItemReadListener, ItemProcessListener, ItemWriteListener { @@ -66,7 +68,7 @@ public class ItemListenerSupport implements ItemReadListener, ItemProce * java.lang.Object) */ @Override - public void afterProcess(I item, O result) { + public void afterProcess(I item, @Nullable O result) { } /* diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/listener/JobListenerMetaData.java b/spring-batch-core/src/main/java/org/springframework/batch/core/listener/JobListenerMetaData.java index 1426c9d84..b4473b42d 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/listener/JobListenerMetaData.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/listener/JobListenerMetaData.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2013 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. @@ -23,12 +23,14 @@ import org.springframework.batch.core.JobExecution; import org.springframework.batch.core.JobExecutionListener; import org.springframework.batch.core.annotation.AfterJob; import org.springframework.batch.core.annotation.BeforeJob; +import org.springframework.lang.Nullable; /** * Enumeration for {@link JobExecutionListener} meta data, which ties together the names * of methods, their interfaces, annotation, and expected arguments. * * @author Lucas Ward + * @author Mahmoud Ben Hassine * @since 2.0 * @see JobListenerFactoryBean */ @@ -85,8 +87,9 @@ public enum JobListenerMetaData implements ListenerMetaData { * Return the relevant meta data for the provided property name. * * @param propertyName name of the property to retrieve. - * @return meta data with supplied property name, null if none exists. + * @return meta data with supplied property name, {@code null} if none exists. */ + @Nullable public static JobListenerMetaData fromPropertyName(String propertyName){ return propertyMap.get(propertyName); } diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/listener/MulticasterBatchListener.java b/spring-batch-core/src/main/java/org/springframework/batch/core/listener/MulticasterBatchListener.java index a0761ac8d..c9dae84c6 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/listener/MulticasterBatchListener.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/listener/MulticasterBatchListener.java @@ -33,6 +33,7 @@ import org.springframework.batch.core.StepExecutionListener; import org.springframework.batch.core.StepListener; import org.springframework.batch.core.scope.context.ChunkContext; import org.springframework.batch.item.ItemStream; +import org.springframework.lang.Nullable; /** * @author Dave Syer @@ -130,7 +131,7 @@ ItemProcessListener, ItemWriteListener, SkipListener, RetryReadLi * java.lang.Object) */ @Override - public void afterProcess(T item, S result) { + public void afterProcess(T item, @Nullable S result) { try { itemProcessListener.afterProcess(item, result); } @@ -222,7 +223,7 @@ ItemProcessListener, ItemWriteListener, SkipListener, RetryReadLi * @see org.springframework.batch.core.listener.CompositeItemReadListener#afterRead(java.lang.Object) */ @Override - public void afterRead(T item) { + public void afterRead(@Nullable T item) { try { itemReadListener.afterRead(item); } diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/listener/StepListenerSupport.java b/spring-batch-core/src/main/java/org/springframework/batch/core/listener/StepListenerSupport.java index 567ce3075..be9dd19a7 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/listener/StepListenerSupport.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/listener/StepListenerSupport.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. @@ -27,12 +27,14 @@ import org.springframework.batch.core.StepExecution; import org.springframework.batch.core.StepExecutionListener; import org.springframework.batch.core.StepListener; import org.springframework.batch.core.scope.context.ChunkContext; +import org.springframework.lang.Nullable; /** * Basic no-op implementations of all {@link StepListener} interfaces. * * @author Lucas Ward * @author Robert Kasanicky + * @author Mahmoud Ben Hassine */ public class StepListenerSupport implements StepExecutionListener, ChunkListener, ItemReadListener, ItemProcessListener, ItemWriteListener, SkipListener { @@ -70,7 +72,7 @@ ItemReadListener, ItemProcessListener, ItemWriteListener, SkipListene * @see org.springframework.batch.core.domain.ItemReadListener#afterRead(java.lang.Object) */ @Override - public void afterRead(T item) { + public void afterRead(@Nullable T item) { } /* (non-Javadoc) @@ -112,7 +114,7 @@ ItemReadListener, ItemProcessListener, ItemWriteListener, SkipListene * @see org.springframework.batch.core.ItemProcessListener#afterProcess(java.lang.Object, java.lang.Object) */ @Override - public void afterProcess(T item, S result) { + public void afterProcess(T item, @Nullable S result) { } /* (non-Javadoc) diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/listener/package-info.java b/spring-batch-core/src/main/java/org/springframework/batch/core/listener/package-info.java index 1ed2f761b..0f23a4ab8 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/listener/package-info.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/listener/package-info.java @@ -2,5 +2,9 @@ * Generic implementations of core batch listener interfaces. * * @author Michael Minella + * @author Mahmoud Ben Hassine */ -package org.springframework.batch.core.listener; \ No newline at end of file +@NonNullApi +package org.springframework.batch.core.listener; + +import org.springframework.lang.NonNullApi; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/package-info.java b/spring-batch-core/src/main/java/org/springframework/batch/core/package-info.java index b5181edd4..b68e233a7 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/package-info.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/package-info.java @@ -4,5 +4,9 @@ * There is a reference implementation of the core interfaces in the execution module. * * @author Michael Minella + * @author Mahmoud Ben Hassine */ -package org.springframework.batch.core; \ No newline at end of file +@NonNullApi +package org.springframework.batch.core; + +import org.springframework.lang.NonNullApi; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/partition/package-info.java b/spring-batch-core/src/main/java/org/springframework/batch/core/partition/package-info.java index faed3103c..c6e4a484b 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/partition/package-info.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/partition/package-info.java @@ -2,5 +2,9 @@ * Interfaces for partitioning components. * * @author Michael Minella + * @author Mahmoud Ben Hassine */ -package org.springframework.batch.core.partition; \ No newline at end of file +@NonNullApi +package org.springframework.batch.core.partition; + +import org.springframework.lang.NonNullApi; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/partition/support/package-info.java b/spring-batch-core/src/main/java/org/springframework/batch/core/partition/support/package-info.java index 9fb238289..2e8601b4f 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/partition/support/package-info.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/partition/support/package-info.java @@ -2,5 +2,9 @@ * Implementation of common partition components. * * @author Michael Minella + * @author Mahmoud Ben Hassine */ -package org.springframework.batch.core.partition.support; \ No newline at end of file +@NonNullApi +package org.springframework.batch.core.partition.support; + +import org.springframework.lang.NonNullApi; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/repository/JobRepository.java b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/JobRepository.java index fee05375b..3ab984bf0 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/repository/JobRepository.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/JobRepository.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. @@ -25,6 +25,7 @@ import org.springframework.batch.core.StepExecution; import org.springframework.batch.core.repository.dao.JobExecutionDao; import org.springframework.batch.core.repository.dao.JobInstanceDao; import org.springframework.batch.item.ExecutionContext; +import org.springframework.lang.Nullable; import org.springframework.transaction.annotation.Isolation; import java.util.Collection; @@ -43,6 +44,7 @@ import java.util.Collection; * @author Robert Kasanicky * @author David Turanski * @author Michael Minella + * @author Mahmoud Ben Hassine */ public interface JobRepository { @@ -181,6 +183,7 @@ public interface JobRepository { * @param stepName the name of the step execution that might have run. * @return the last execution of step for the given job instance. */ + @Nullable StepExecution getLastStepExecution(JobInstance jobInstance, String stepName); /** @@ -195,6 +198,7 @@ public interface JobRepository { * @param jobParameters parameters identifying the {@link JobInstance} * @return the last execution of job if exists, null otherwise */ + @Nullable JobExecution getLastJobExecution(String jobName, JobParameters jobParameters); } diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/JdbcJobExecutionDao.java b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/JdbcJobExecutionDao.java index 9c0acabd0..0d131f875 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/JdbcJobExecutionDao.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/JdbcJobExecutionDao.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. @@ -43,6 +43,7 @@ import org.springframework.dao.OptimisticLockingFailureException; import org.springframework.jdbc.core.RowCallbackHandler; import org.springframework.jdbc.core.RowMapper; import org.springframework.jdbc.support.incrementer.DataFieldMaxValueIncrementer; +import org.springframework.lang.Nullable; import org.springframework.util.Assert; /** @@ -58,6 +59,7 @@ import org.springframework.util.Assert; * @author Dave Syer * @author Robert Kasanicky * @author Michael Minella + * @author Mahmoud Ben Hassine */ public class JdbcJobExecutionDao extends AbstractJdbcBatchMetadataDao implements JobExecutionDao, InitializingBean { @@ -241,7 +243,7 @@ public class JdbcJobExecutionDao extends AbstractJdbcBatchMetadataDao implements } @Override - public JobExecution getLastJobExecution(JobInstance jobInstance) { + public JobExecution getLastJobExecution(@Nullable JobInstance jobInstance) { Long id = jobInstance.getId(); @@ -265,6 +267,7 @@ public class JdbcJobExecutionDao extends AbstractJdbcBatchMetadataDao implements * getLastJobExecution(java.lang.String) */ @Override + @Nullable public JobExecution getJobExecution(Long executionId) { try { JobExecution jobExecution = getJdbcTemplate().queryForObject(getQuery(GET_EXECUTION_BY_ID), diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/JdbcJobInstanceDao.java b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/JdbcJobInstanceDao.java index 1d618c5f3..2d88f6f35 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/JdbcJobInstanceDao.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/JdbcJobInstanceDao.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2014 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. @@ -34,6 +34,7 @@ import org.springframework.dao.EmptyResultDataAccessException; import org.springframework.jdbc.core.ResultSetExtractor; import org.springframework.jdbc.core.RowMapper; import org.springframework.jdbc.support.incrementer.DataFieldMaxValueIncrementer; +import org.springframework.lang.Nullable; import org.springframework.util.Assert; import org.springframework.util.StringUtils; @@ -51,6 +52,7 @@ import org.springframework.util.StringUtils; * @author Robert Kasanicky * @author Michael Minella * @author Will Schipp + * @author Mahmoud Ben Hassine */ public class JdbcJobInstanceDao extends AbstractJdbcBatchMetadataDao implements JobInstanceDao, InitializingBean { @@ -130,6 +132,7 @@ JobInstanceDao, InitializingBean { * if any {@link JobParameters} fields are null. */ @Override + @Nullable public JobInstance getJobInstance(final String jobName, final JobParameters jobParameters) { @@ -166,7 +169,8 @@ JobInstanceDao, InitializingBean { * (java.lang.Long) */ @Override - public JobInstance getJobInstance(Long instanceId) { + @Nullable + public JobInstance getJobInstance(@Nullable Long instanceId) { try { return getJdbcTemplate().queryForObject(getQuery(GET_JOB_FROM_ID), @@ -241,6 +245,7 @@ JobInstanceDao, InitializingBean { * (org.springframework.batch.core.JobExecution) */ @Override + @Nullable public JobInstance getJobInstance(JobExecution jobExecution) { try { @@ -256,7 +261,7 @@ JobInstanceDao, InitializingBean { * @see org.springframework.batch.core.repository.dao.JobInstanceDao#getJobInstanceCount(java.lang.String) */ @Override - public int getJobInstanceCount(String jobName) throws NoSuchJobException { + public int getJobInstanceCount(@Nullable String jobName) throws NoSuchJobException { try { return getJdbcTemplate().queryForObject( diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/JdbcStepExecutionDao.java b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/JdbcStepExecutionDao.java index 3cec3edcc..3c591534a 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/JdbcStepExecutionDao.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/JdbcStepExecutionDao.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. @@ -39,6 +39,7 @@ import org.springframework.dao.OptimisticLockingFailureException; import org.springframework.jdbc.core.BatchPreparedStatementSetter; import org.springframework.jdbc.core.RowMapper; import org.springframework.jdbc.support.incrementer.DataFieldMaxValueIncrementer; +import org.springframework.lang.Nullable; import org.springframework.util.Assert; /** @@ -58,6 +59,7 @@ import org.springframework.util.Assert; * @author Dave Syer * @author Robert Kasanicky * @author David Turanski + * @author Mahmoud Ben Hassine * * @see StepExecutionDao */ @@ -281,6 +283,7 @@ public class JdbcStepExecutionDao extends AbstractJdbcBatchMetadataDao implement } @Override + @Nullable public StepExecution getStepExecution(JobExecution jobExecution, Long stepExecutionId) { List executions = getJdbcTemplate().query(getQuery(GET_STEP_EXECUTION), new StepExecutionRowMapper(jobExecution), jobExecution.getId(), stepExecutionId); diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/JobExecutionDao.java b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/JobExecutionDao.java index 18b5f4bc0..bc729e310 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/JobExecutionDao.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/JobExecutionDao.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. @@ -21,12 +21,14 @@ import java.util.Set; import org.springframework.batch.core.JobExecution; import org.springframework.batch.core.JobInstance; +import org.springframework.lang.Nullable; /** * Data Access Object for job executions. * * @author Lucas Ward * @author Robert Kasanicky + * @author Mahmoud Ben Hassine */ public interface JobExecutionDao { @@ -63,8 +65,10 @@ public interface JobExecutionDao { * Find the last {@link JobExecution} to have been created for a given * {@link JobInstance}. * @param jobInstance the {@link JobInstance} - * @return the last {@link JobExecution} to execute for this instance + * @return the last {@link JobExecution} to execute for this instance or + * {@code null} if no job execution is found for the given job instance. */ + @Nullable JobExecution getLastJobExecution(JobInstance jobInstance); /** @@ -78,6 +82,7 @@ public interface JobExecutionDao { * @param executionId {@link Long} containing the id of the execution. * @return the {@link JobExecution} for given identifier. */ + @Nullable JobExecution getJobExecution(Long executionId); /** diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/JobInstanceDao.java b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/JobInstanceDao.java index 6e813c33a..8a8792672 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/JobInstanceDao.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/JobInstanceDao.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.core.JobExecution; import org.springframework.batch.core.JobInstance; import org.springframework.batch.core.JobParameters; import org.springframework.batch.core.launch.NoSuchJobException; +import org.springframework.lang.Nullable; /** * Data Access Object for job instances. @@ -29,6 +30,7 @@ import org.springframework.batch.core.launch.NoSuchJobException; * @author Lucas Ward * @author Robert Kasanicky * @author Michael Minella + * @author Mahmoud Ben Hassine * */ public interface JobInstanceDao { @@ -56,24 +58,27 @@ public interface JobInstanceDao { * @param jobName the name of the job * @param jobParameters the parameters with which the job was executed * @return {@link JobInstance} object matching the job name and - * {@link JobParameters} or null + * {@link JobParameters} or {@code null} */ + @Nullable JobInstance getJobInstance(String jobName, JobParameters jobParameters); /** * Fetch the job instance with the provided identifier. * * @param instanceId the job identifier - * @return the job instance with this identifier or null if it doesn't exist + * @return the job instance with this identifier or {@code null} if it doesn't exist */ - JobInstance getJobInstance(Long instanceId); + @Nullable + JobInstance getJobInstance(@Nullable Long instanceId); /** * Fetch the JobInstance for the provided JobExecution. * * @param jobExecution the JobExecution - * @return the JobInstance for the provided execution or null if it doesn't exist. + * @return the JobInstance for the provided execution or {@code null} if it doesn't exist. */ + @Nullable JobInstance getJobInstance(JobExecution jobExecution); /** @@ -122,6 +127,6 @@ public interface JobInstanceDao { * * @throws NoSuchJobException thrown if no Job has the jobName specified. */ - int getJobInstanceCount(String jobName) throws NoSuchJobException; + int getJobInstanceCount(@Nullable String jobName) throws NoSuchJobException; } diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/MapJobExecutionDao.java b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/MapJobExecutionDao.java index b037297cd..b819f5183 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/MapJobExecutionDao.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/MapJobExecutionDao.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2014 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 java.util.concurrent.atomic.AtomicLong; import org.springframework.batch.core.JobExecution; import org.springframework.batch.core.JobInstance; import org.springframework.dao.OptimisticLockingFailureException; +import org.springframework.lang.Nullable; import org.springframework.util.Assert; import org.springframework.util.SerializationUtils; @@ -106,7 +107,7 @@ public class MapJobExecutionDao implements JobExecutionDao { } @Override - public JobExecution getLastJobExecution(JobInstance jobInstance) { + public JobExecution getLastJobExecution(@Nullable JobInstance jobInstance) { JobExecution lastExec = null; for (JobExecution exec : executionsById.values()) { if (!exec.getJobInstance().equals(jobInstance)) { @@ -148,6 +149,7 @@ public class MapJobExecutionDao implements JobExecutionDao { * (java.lang.Long) */ @Override + @Nullable public JobExecution getJobExecution(Long executionId) { return copy(executionsById.get(executionId)); } diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/MapJobInstanceDao.java b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/MapJobInstanceDao.java index 14728487f..73adbbb49 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/MapJobInstanceDao.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/MapJobInstanceDao.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2014 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. @@ -30,6 +30,7 @@ import org.springframework.batch.core.JobInstance; import org.springframework.batch.core.JobKeyGenerator; import org.springframework.batch.core.JobParameters; import org.springframework.batch.core.launch.NoSuchJobException; +import org.springframework.lang.Nullable; import org.springframework.util.Assert; /** @@ -63,12 +64,14 @@ public class MapJobInstanceDao implements JobInstanceDao { } @Override + @Nullable public JobInstance getJobInstance(String jobName, JobParameters jobParameters) { return jobInstances.get(jobName + "|" + jobKeyGenerator.generateKey(jobParameters)); } @Override - public JobInstance getJobInstance(Long instanceId) { + @Nullable + public JobInstance getJobInstance(@Nullable Long instanceId) { for (Map.Entry instanceEntry : jobInstances.entrySet()) { JobInstance instance = instanceEntry.getValue(); if (instance.getId().equals(instanceId)) { @@ -104,12 +107,13 @@ public class MapJobInstanceDao implements JobInstanceDao { } @Override + @Nullable public JobInstance getJobInstance(JobExecution jobExecution) { return jobExecution.getJobInstance(); } @Override - public int getJobInstanceCount(String jobName) throws NoSuchJobException { + public int getJobInstanceCount(@Nullable String jobName) throws NoSuchJobException { int count = 0; for (Map.Entry instanceEntry : jobInstances.entrySet()) { diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/MapStepExecutionDao.java b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/MapStepExecutionDao.java index fda49cb40..fedd80f45 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/MapStepExecutionDao.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/MapStepExecutionDao.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2014 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.core.Entity; import org.springframework.batch.core.JobExecution; import org.springframework.batch.core.StepExecution; import org.springframework.dao.OptimisticLockingFailureException; +import org.springframework.lang.Nullable; import org.springframework.util.Assert; import org.springframework.util.ReflectionUtils; import org.springframework.util.SerializationUtils; @@ -113,6 +114,7 @@ public class MapStepExecutionDao implements StepExecutionDao { } @Override + @Nullable public StepExecution getStepExecution(JobExecution jobExecution, Long stepExecutionId) { return executionsByStepExecutionId.get(stepExecutionId); } diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/StepExecutionDao.java b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/StepExecutionDao.java index 90353c62a..a037d38c2 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/StepExecutionDao.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/StepExecutionDao.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. @@ -20,6 +20,7 @@ import java.util.Collection; import org.springframework.batch.core.JobExecution; import org.springframework.batch.core.StepExecution; +import org.springframework.lang.Nullable; public interface StepExecutionDao { @@ -61,6 +62,7 @@ public interface StepExecutionDao { * @param stepExecutionId the step execution id * @return a {@link StepExecution} */ + @Nullable StepExecution getStepExecution(JobExecution jobExecution, Long stepExecutionId); /** diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/package-info.java b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/package-info.java index 9ef134d00..88e0759c1 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/package-info.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/package-info.java @@ -2,5 +2,9 @@ * Specific implementations of dao concerns. * * @author Michael Minella + * @author Mahmoud Ben Hassine */ -package org.springframework.batch.core.repository.dao; \ No newline at end of file +@NonNullApi +package org.springframework.batch.core.repository.dao; + +import org.springframework.lang.NonNullApi; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/repository/package-info.java b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/package-info.java index 550508154..46105e337 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/repository/package-info.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/package-info.java @@ -2,5 +2,9 @@ * Interfaces and generic implementations of repository concerns. * * @author Michael Minella + * @author Mahmoud Ben Hassine */ -package org.springframework.batch.core.repository; \ No newline at end of file +@NonNullApi +package org.springframework.batch.core.repository; + +import org.springframework.lang.NonNullApi; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/repository/support/SimpleJobRepository.java b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/support/SimpleJobRepository.java index 717a77294..ecfb5ba64 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/repository/support/SimpleJobRepository.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/support/SimpleJobRepository.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2014 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. @@ -32,6 +32,7 @@ import org.springframework.batch.core.repository.dao.JobExecutionDao; import org.springframework.batch.core.repository.dao.JobInstanceDao; import org.springframework.batch.core.repository.dao.StepExecutionDao; import org.springframework.batch.item.ExecutionContext; +import org.springframework.lang.Nullable; import org.springframework.util.Assert; import java.util.ArrayList; @@ -50,6 +51,7 @@ import java.util.List; * @author Dave Syer * @author Robert Kasanicky * @author David Turanski + * @author Mahmoud Ben Hassine * * @see JobRepository * @see JobInstanceDao @@ -215,6 +217,7 @@ public class SimpleJobRepository implements JobRepository { } @Override + @Nullable public StepExecution getLastStepExecution(JobInstance jobInstance, String stepName) { List jobExecutions = jobExecutionDao.findJobExecutions(jobInstance); List stepExecutions = new ArrayList(jobExecutions.size()); @@ -289,6 +292,7 @@ public class SimpleJobRepository implements JobRepository { } @Override + @Nullable public JobExecution getLastJobExecution(String jobName, JobParameters jobParameters) { JobInstance jobInstance = jobInstanceDao.getJobInstance(jobName, jobParameters); if (jobInstance == null) { diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/repository/support/package-info.java b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/support/package-info.java index 463c1b466..434f78772 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/repository/support/package-info.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/support/package-info.java @@ -2,5 +2,9 @@ * Specific implementations of repository concerns. * * @author Michael Minella + * @author Mahmoud Ben Hassine */ -package org.springframework.batch.core.repository.support; \ No newline at end of file +@NonNullApi +package org.springframework.batch.core.repository.support; + +import org.springframework.lang.NonNullApi; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/scope/context/JobContext.java b/spring-batch-core/src/main/java/org/springframework/batch/core/scope/context/JobContext.java index b838d0485..2010c81af 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/scope/context/JobContext.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/scope/context/JobContext.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. @@ -33,6 +33,7 @@ import org.springframework.batch.core.UnexpectedJobExecutionException; import org.springframework.batch.core.scope.StepScope; import org.springframework.batch.item.ExecutionContext; import org.springframework.batch.repeat.context.SynchronizedAttributeAccessor; +import org.springframework.lang.Nullable; import org.springframework.util.Assert; /** @@ -44,6 +45,7 @@ import org.springframework.util.Assert; * * @author Dave Syer * @author Jimmy Praet (create JobContext based on {@link StepContext}) + * @author Mahmoud Ben Hassine * @since 3.0 */ public class JobContext extends SynchronizedAttributeAccessor { @@ -134,6 +136,7 @@ public class JobContext extends SynchronizedAttributeAccessor { * @see SynchronizedAttributeAccessor#removeAttribute(String) */ @Override + @Nullable public Object removeAttribute(String name) { unregisterDestructionCallbacks(name); return super.removeAttribute(name); diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/scope/context/JobSynchronizationManager.java b/spring-batch-core/src/main/java/org/springframework/batch/core/scope/context/JobSynchronizationManager.java index 6d34ffa27..e0ca0c953 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/scope/context/JobSynchronizationManager.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/scope/context/JobSynchronizationManager.java @@ -1,5 +1,5 @@ /* - * Copyright 2013 the original author or authors. + * Copyright 2013-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,6 +18,7 @@ package org.springframework.batch.core.scope.context; import org.springframework.batch.core.Job; import org.springframework.batch.core.JobExecution; import org.springframework.batch.core.jsr.configuration.support.BatchPropertyContext; +import org.springframework.lang.Nullable; /** * Central convenience class for framework use in managing the job scope @@ -28,6 +29,7 @@ import org.springframework.batch.core.jsr.configuration.support.BatchPropertyCon * * @author Dave Syer * @author Jimmy Praet + * @author Mahmoud Ben Hassine * @since 3.0 */ public class JobSynchronizationManager { @@ -46,11 +48,12 @@ public class JobSynchronizationManager { }; /** - * Getter for the current context if there is one, otherwise returns null. + * Getter for the current context if there is one, otherwise returns {@code null}. * - * @return the current {@link JobContext} or null if there is none (if one + * @return the current {@link JobContext} or {@code null} if there is none (if one * has not been registered for this thread). */ + @Nullable public static JobContext getContext() { return manager.getContext(); } diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/scope/context/StepContext.java b/spring-batch-core/src/main/java/org/springframework/batch/core/scope/context/StepContext.java index d820c66cc..cfe36d6a6 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/scope/context/StepContext.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/scope/context/StepContext.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. @@ -34,6 +34,7 @@ import org.springframework.batch.core.jsr.configuration.support.BatchPropertyCon import org.springframework.batch.core.scope.StepScope; import org.springframework.batch.item.ExecutionContext; import org.springframework.batch.repeat.context.SynchronizedAttributeAccessor; +import org.springframework.lang.Nullable; import org.springframework.util.Assert; /** @@ -46,6 +47,7 @@ import org.springframework.util.Assert; * * @author Dave Syer * @author Michael Minella + * @author Mahmoud Ben Hassine * */ public class StepContext extends SynchronizedAttributeAccessor { @@ -184,6 +186,7 @@ public class StepContext extends SynchronizedAttributeAccessor { * @see SynchronizedAttributeAccessor#removeAttribute(String) */ @Override + @Nullable public Object removeAttribute(String name) { unregisterDestructionCallbacks(name); return super.removeAttribute(name); diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/scope/context/StepContextRepeatCallback.java b/spring-batch-core/src/main/java/org/springframework/batch/core/scope/context/StepContextRepeatCallback.java index 04dcf9047..58e84af8b 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/scope/context/StepContextRepeatCallback.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/scope/context/StepContextRepeatCallback.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. @@ -25,6 +25,7 @@ import org.springframework.batch.core.StepExecution; import org.springframework.batch.repeat.RepeatCallback; import org.springframework.batch.repeat.RepeatContext; import org.springframework.batch.repeat.RepeatStatus; +import org.springframework.lang.Nullable; import org.springframework.util.ObjectUtils; /** @@ -32,6 +33,7 @@ import org.springframework.util.ObjectUtils; * callback inside a {@link Step}. * * @author Dave Syer + * @author Mahmoud Ben Hassine * */ public abstract class StepContextRepeatCallback implements RepeatCallback { @@ -60,6 +62,7 @@ public abstract class StepContextRepeatCallback implements RepeatCallback { * @see RepeatCallback#doInIteration(RepeatContext) */ @Override + @Nullable public RepeatStatus doInIteration(RepeatContext context) throws Exception { // The StepContext has to be the same for all chunks, @@ -106,6 +109,7 @@ public abstract class StepContextRepeatCallback implements RepeatCallback { * @throws Exception implementations can throw an exception if anything goes * wrong */ + @Nullable public abstract RepeatStatus doInChunkContext(RepeatContext context, ChunkContext chunkContext) throws Exception; } diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/scope/context/StepSynchronizationManager.java b/spring-batch-core/src/main/java/org/springframework/batch/core/scope/context/StepSynchronizationManager.java index 4d4d37181..91c2114f1 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/scope/context/StepSynchronizationManager.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/scope/context/StepSynchronizationManager.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. @@ -18,6 +18,7 @@ package org.springframework.batch.core.scope.context; import org.springframework.batch.core.Step; import org.springframework.batch.core.StepExecution; import org.springframework.batch.core.jsr.configuration.support.BatchPropertyContext; +import org.springframework.lang.Nullable; /** * Central convenience class for framework use in managing the step scope @@ -28,6 +29,7 @@ import org.springframework.batch.core.jsr.configuration.support.BatchPropertyCon * * @author Dave Syer * @author Michael Minella + * @author Mahmoud Ben Hassine * */ public class StepSynchronizationManager { @@ -55,11 +57,12 @@ public class StepSynchronizationManager { }; /** - * Getter for the current context if there is one, otherwise returns null. + * Getter for the current context if there is one, otherwise returns {@code null}. * - * @return the current {@link StepContext} or null if there is none (if one + * @return the current {@link StepContext} or {@code null} if there is none (if one * has not been registered for this thread). */ + @Nullable public static StepContext getContext() { return manager.getContext(); } diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/scope/context/SynchronizationManagerSupport.java b/spring-batch-core/src/main/java/org/springframework/batch/core/scope/context/SynchronizationManagerSupport.java index b70d43b5e..5881b3818 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/scope/context/SynchronizationManagerSupport.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/scope/context/SynchronizationManagerSupport.java @@ -1,5 +1,5 @@ /* - * Copyright 2013 the original author or authors. + * Copyright 2013-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 java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.atomic.AtomicInteger; import org.springframework.batch.core.jsr.configuration.support.BatchPropertyContext; +import org.springframework.lang.Nullable; /** @@ -29,6 +30,7 @@ import org.springframework.batch.core.jsr.configuration.support.BatchPropertyCon * * @author Dave Syer * @author Jimmy Praet + * @author Mahmoud Ben Hassine * @since 3.0 */ public abstract class SynchronizationManagerSupport { @@ -61,11 +63,12 @@ public abstract class SynchronizationManagerSupport { private final Map contexts = new ConcurrentHashMap(); /** - * Getter for the current context if there is one, otherwise returns null. + * Getter for the current context if there is one, otherwise returns {@code null}. * - * @return the current context or null if there is none (if one + * @return the current context or {@code null} if there is none (if one * has not been registered for this thread). */ + @Nullable public C getContext() { if (getCurrent().isEmpty()) { return null; @@ -84,7 +87,8 @@ public abstract class SynchronizationManagerSupport { * @return a new context or the current one if it has the same * execution */ - public C register(E execution) { + @Nullable + public C register(@Nullable E execution) { if (execution == null) { return null; } @@ -111,7 +115,8 @@ public abstract class SynchronizationManagerSupport { * @return a new context or the current one if it has the same * execution */ - public C register(E execution, BatchPropertyContext propertyContext) { + @Nullable + public C register(@Nullable E execution, @Nullable BatchPropertyContext propertyContext) { if (execution == null) { return null; } @@ -197,6 +202,6 @@ public abstract class SynchronizationManagerSupport { protected abstract void close(C context); - protected abstract C createNewContext(E execution, BatchPropertyContext propertyContext); + protected abstract C createNewContext(E execution, @Nullable BatchPropertyContext propertyContext); } diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/scope/context/package-info.java b/spring-batch-core/src/main/java/org/springframework/batch/core/scope/context/package-info.java index d158cc937..a12e79cc4 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/scope/context/package-info.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/scope/context/package-info.java @@ -2,5 +2,9 @@ * Implementation of the contexts for each of the custom bean scopes in Spring Batch (Job and Step). * * @author Michael Minella + * @author Mahmoud Ben Hassine */ -package org.springframework.batch.core.scope.context; \ No newline at end of file +@NonNullApi +package org.springframework.batch.core.scope.context; + +import org.springframework.lang.NonNullApi; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/scope/package-info.java b/spring-batch-core/src/main/java/org/springframework/batch/core/scope/package-info.java index 9714c68d6..b79fafb67 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/scope/package-info.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/scope/package-info.java @@ -2,5 +2,9 @@ * Implementation of Spring Batch specific bean scopes (Job and Step). * * @author Michael Minella + * @author Mahmoud Ben Hassine */ -package org.springframework.batch.core.scope; \ No newline at end of file +@NonNullApi +package org.springframework.batch.core.scope; + +import org.springframework.lang.NonNullApi; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/step/AbstractStep.java b/spring-batch-core/src/main/java/org/springframework/batch/core/step/AbstractStep.java index 492388bcf..3f7ac22a3 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/step/AbstractStep.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/step/AbstractStep.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. @@ -48,6 +48,7 @@ import org.springframework.util.ClassUtils; * @author Robert Kasanicky * @author Michael Minella * @author Chris Schaefer + * @author Mahmoud Ben Hassine */ public abstract class AbstractStep implements Step, InitializingBean, BeanNameAware { @@ -180,6 +181,8 @@ public abstract class AbstractStep implements Step, InitializingBean, BeanNameAw public final void execute(StepExecution stepExecution) throws JobInterruptedException, UnexpectedJobExecutionException { + Assert.notNull(stepExecution, "stepExecution must not be null"); + if (logger.isDebugEnabled()) { logger.debug("Executing: id=" + stepExecution.getId()); } diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/step/builder/package-info.java b/spring-batch-core/src/main/java/org/springframework/batch/core/step/builder/package-info.java index e148dc4a6..e8d832a42 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/step/builder/package-info.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/step/builder/package-info.java @@ -2,5 +2,9 @@ * Step level builders for java based job configuration. * * @author Michael Minella + * @author Mahmoud Ben Hassine */ -package org.springframework.batch.core.step.builder; \ No newline at end of file +@NonNullApi +package org.springframework.batch.core.step.builder; + +import org.springframework.lang.NonNullApi; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/step/factory/package-info.java b/spring-batch-core/src/main/java/org/springframework/batch/core/step/factory/package-info.java index ae8f986c1..030917bc8 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/step/factory/package-info.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/step/factory/package-info.java @@ -2,5 +2,9 @@ * Factories for step level components. * * @author Michael Minella + * @author Mahmoud Ben Hassine */ -package org.springframework.batch.core.step.factory; \ No newline at end of file +@NonNullApi +package org.springframework.batch.core.step.factory; + +import org.springframework.lang.NonNullApi; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/SimpleChunkProvider.java b/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/SimpleChunkProvider.java index fc1e25e5c..6fa86481e 100755 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/SimpleChunkProvider.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/SimpleChunkProvider.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. @@ -28,6 +28,7 @@ import org.springframework.batch.repeat.RepeatCallback; import org.springframework.batch.repeat.RepeatContext; import org.springframework.batch.repeat.RepeatOperations; import org.springframework.batch.repeat.RepeatStatus; +import org.springframework.lang.Nullable; /** * Simple implementation of the ChunkProvider interface that does basic chunk @@ -35,6 +36,7 @@ import org.springframework.batch.repeat.RepeatStatus; * * @author Dave Syer * @author Michael Minella + * @author Mahmoud Ben Hassine * @see ChunkOrientedTasklet */ public class SimpleChunkProvider implements ChunkProvider { @@ -82,9 +84,10 @@ public class SimpleChunkProvider implements ChunkProvider { /** * Surrounds the read call with listener callbacks. - * @return item + * @return the item or {@code null} if the data source is exhausted * @throws Exception is thrown if error occurs during read. */ + @Nullable protected final I doRead() throws Exception { try { listener.beforeRead(); @@ -146,13 +149,14 @@ public class SimpleChunkProvider implements ChunkProvider { * * @param contribution the current step execution contribution * @param chunk the current chunk - * @return a new item for processing + * @return a new item for processing or {@code null} if the data source is exhausted * * @throws SkipOverflowException if specifically the chunk is accumulating * too much data (e.g. skips) and it wants to force a commit. * * @throws Exception if there is a generic issue */ + @Nullable protected I read(StepContribution contribution, Chunk chunk) throws SkipOverflowException, Exception { return doRead(); } diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/SkipWrapper.java b/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/SkipWrapper.java index 854e375ba..b5cf00c72 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/SkipWrapper.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/SkipWrapper.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,10 +16,13 @@ package org.springframework.batch.core.step.item; +import org.springframework.lang.Nullable; + /** * Wrapper for an item and its exception if it failed processing. * * @author Dave Syer + * @author Mahmoud Ben Hassine * */ public class SkipWrapper { @@ -43,7 +46,7 @@ public class SkipWrapper { } - public SkipWrapper(T item, Throwable e) { + public SkipWrapper(T item, @Nullable Throwable e) { this.item = item; this.exception = e; } @@ -52,6 +55,7 @@ public class SkipWrapper { * Public getter for the exception. * @return the exception */ + @Nullable public Throwable getException() { return exception; } @@ -69,4 +73,4 @@ public class SkipWrapper { return String.format("[exception=%s, item=%s]", exception, item); } -} \ No newline at end of file +} diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/package-info.java b/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/package-info.java index 7b629a338..3b75c6cf6 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/package-info.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/package-info.java @@ -2,5 +2,9 @@ * Specific implementations of step concerns for item-oriented approach. * * @author Michael Minella + * @author Mahmoud Ben Hassine */ -package org.springframework.batch.core.step.item; \ No newline at end of file +@NonNullApi +package org.springframework.batch.core.step.item; + +import org.springframework.lang.NonNullApi; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/step/job/package-info.java b/spring-batch-core/src/main/java/org/springframework/batch/core/step/job/package-info.java index fe22ae868..e088a032d 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/step/job/package-info.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/step/job/package-info.java @@ -2,5 +2,9 @@ * {@link org.springframework.batch.core.step.job.JobStep} and related components. * * @author Michael Minella + * @author Mahmoud Ben Hassine */ -package org.springframework.batch.core.step.job; \ No newline at end of file +@NonNullApi +package org.springframework.batch.core.step.job; + +import org.springframework.lang.NonNullApi; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/step/package-info.java b/spring-batch-core/src/main/java/org/springframework/batch/core/step/package-info.java index 6834b2874..08fe3c3b8 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/step/package-info.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/step/package-info.java @@ -2,5 +2,9 @@ * Specific implementations of step concerns. * * @author Michael Minella + * @author Mahmoud Ben Hassine */ -package org.springframework.batch.core.step; \ No newline at end of file +@NonNullApi +package org.springframework.batch.core.step; + +import org.springframework.lang.NonNullApi; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/step/skip/package-info.java b/spring-batch-core/src/main/java/org/springframework/batch/core/step/skip/package-info.java index 51353a268..5305064e2 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/step/skip/package-info.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/step/skip/package-info.java @@ -2,5 +2,9 @@ * Specific implementations of skip concerns for items in a step. * * @author Michael Minella + * @author Mahmoud Ben Hassine */ -package org.springframework.batch.core.step.skip; \ No newline at end of file +@NonNullApi +package org.springframework.batch.core.step.skip; + +import org.springframework.lang.NonNullApi; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/step/tasklet/Tasklet.java b/spring-batch-core/src/main/java/org/springframework/batch/core/step/tasklet/Tasklet.java index 7f64003e2..5f15882c2 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/step/tasklet/Tasklet.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/step/tasklet/Tasklet.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. @@ -18,11 +18,13 @@ package org.springframework.batch.core.step.tasklet; import org.springframework.batch.core.StepContribution; import org.springframework.batch.core.scope.context.ChunkContext; import org.springframework.batch.repeat.RepeatStatus; +import org.springframework.lang.Nullable; /** * Strategy for processing in a step. * * @author Dave Syer + * @author Mahmoud Ben Hassine * */ public interface Tasklet { @@ -38,10 +40,11 @@ public interface Tasklet { * @param chunkContext attributes shared between invocations but not between * restarts * @return an {@link RepeatStatus} indicating whether processing is - * continuable. + * continuable. Returning {@code null} is interpreted as {@link RepeatStatus#FINISHED} * * @throws Exception thrown if error occurs during execution. */ + @Nullable RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext) throws Exception; } diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/step/tasklet/package-info.java b/spring-batch-core/src/main/java/org/springframework/batch/core/step/tasklet/package-info.java index ee1457df3..ff6c2cd78 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/step/tasklet/package-info.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/step/tasklet/package-info.java @@ -2,5 +2,9 @@ * Interfaces and generic implementations of tasklet concerns. * * @author Michael Minella + * @author Mahmoud Ben Hassine */ -package org.springframework.batch.core.step.tasklet; \ No newline at end of file +@NonNullApi +package org.springframework.batch.core.step.tasklet; + +import org.springframework.lang.NonNullApi;