diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/domain/JobParameters.java b/spring-batch-core/src/main/java/org/springframework/batch/core/domain/JobParameters.java index 24667fec1..914ab4dbc 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/domain/JobParameters.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/domain/JobParameters.java @@ -133,6 +133,13 @@ public class JobParameters { return Collections.unmodifiableMap(dateMap); } + /** + * @return true if the prameters is empty, false otherwise. + */ + public boolean isEmpty(){ + return (dateMap.isEmpty() && longMap.isEmpty() && stringMap.isEmpty()); + } + /* * Convenience method for validating that a the provided map only contains a particular * type as a value, with only a String as a key. diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/runtime/JobParametersFactory.java b/spring-batch-core/src/main/java/org/springframework/batch/core/runtime/JobParametersFactory.java index be83e8d26..25a728423 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/runtime/JobParametersFactory.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/runtime/JobParametersFactory.java @@ -38,7 +38,8 @@ import org.springframework.batch.core.domain.JobParametersBuilder; public interface JobParametersFactory { /** - * Get a new {@link JobParameters} instance. + * Get a new {@link JobParameters} instance. If given null, or an empty + * properties, an empty JobParameters will be returned. * * @param properties * the runtime parameters in the form of String literals. @@ -47,7 +48,8 @@ public interface JobParametersFactory { public JobParameters getJobParameters(Properties properties); /** - * The inverse operation: get a {@link Properties} instance. + * The inverse operation: get a {@link Properties} instance. If given + * null or empty JobParameters, an empty Properties should be returned. * * @param params * @return a representation of the parameters as properties