public class DefaultJobParametersValidator extends java.lang.Object implements JobParametersValidator, org.springframework.beans.factory.InitializingBean
JobParametersValidator
.Constructor and Description |
---|
DefaultJobParametersValidator()
Convenient default constructor for unconstrained validation.
|
DefaultJobParametersValidator(java.lang.String[] requiredKeys,
java.lang.String[] optionalKeys)
Create a new validator with the required and optional job parameter keys
provided.
|
Modifier and Type | Method and Description |
---|---|
void |
afterPropertiesSet()
Check that there are no overlaps between required and optional keys.
|
void |
setOptionalKeys(java.lang.String[] optionalKeys)
The keys that are optional in the parameters.
|
void |
setRequiredKeys(java.lang.String[] requiredKeys)
The keys that are required in the parameters.
|
void |
validate(JobParameters parameters)
Check the parameters meet the specification provided.
|
public DefaultJobParametersValidator()
public DefaultJobParametersValidator(java.lang.String[] requiredKeys, java.lang.String[] optionalKeys)
requiredKeys
- the required keysoptionalKeys
- the optional keyssetOptionalKeys(String[])
,
setRequiredKeys(String[])
public void afterPropertiesSet() throws java.lang.IllegalStateException
afterPropertiesSet
in interface org.springframework.beans.factory.InitializingBean
java.lang.IllegalStateException
- if there is an overlappublic void validate(@Nullable JobParameters parameters) throws JobParametersInvalidException
validate
in interface JobParametersValidator
parameters
- some JobParameters
(can be null
)JobParametersInvalidException
- if the parameters are not validJobParametersValidator.validate(JobParameters)
public final void setRequiredKeys(java.lang.String[] requiredKeys)
requiredKeys
- the required key valuessetOptionalKeys(String[])
public final void setOptionalKeys(java.lang.String[] optionalKeys)
optionalKeys
- the optional key valuessetRequiredKeys(String[])