BATCH-304: Modified the CommandLineJobRunner to accept a job name as an argument. Also modified the contract of JobParamterFactory to return an empty JobParameters or Properties if null is passed in, rather than throwing an IllegalArgumentException.
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user