Class AndValidator
- java.lang.Object
-
- org.pentaho.di.job.entry.validator.AndValidator
-
- All Implemented Interfaces:
JobEntryValidator
public class AndValidator extends Object implements JobEntryValidator
Boolean ANDs the results of all validators. If one validator fails,false
is immediately returned. The validators list (aList<JobEntryValidator>
) should be stored under theKEY_VALIDATORS
key.- Author:
- mlowery
-
-
Field Summary
Fields Modifier and Type Field Description static AndValidator
INSTANCE
-
Fields inherited from interface org.pentaho.di.job.entry.validator.JobEntryValidator
KEY_LEVEL_ON_FAIL
-
-
Constructor Summary
Constructors Constructor Description AndValidator()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getKeyValidators()
String
getName()
Returns the name of this validator, unique among all validators.static ValidatorContext
putValidators(JobEntryValidator... validators)
Uses varargs to conveniently add validators to the list of validators consumed byAndValidator
.static void
putValidators(ValidatorContext context, JobEntryValidator... validators)
Uses varargs to conveniently add validators to the list of validators consumed byAndValidator
.boolean
validate(org.pentaho.di.core.CheckResultSourceInterface source, String propertyName, List<org.pentaho.di.core.CheckResultInterface> remarks, ValidatorContext context)
Using reflection, the validator fetches the field namedpropertyName
from the beansource
and runs the validation putting any messages intoremarks
.
-
-
-
Field Detail
-
INSTANCE
public static final AndValidator INSTANCE
-
-
Method Detail
-
validate
public boolean validate(org.pentaho.di.core.CheckResultSourceInterface source, String propertyName, List<org.pentaho.di.core.CheckResultInterface> remarks, ValidatorContext context)
Description copied from interface:JobEntryValidator
Using reflection, the validator fetches the field namedpropertyName
from the beansource
and runs the validation putting any messages intoremarks
. The return value istrue
if the validation passes.- Specified by:
validate
in interfaceJobEntryValidator
- Parameters:
source
- bean to validatepropertyName
- property to validateremarks
- list to which to add messagescontext
- any other information needed to perform the validation- Returns:
- validation result
-
getName
public String getName()
Description copied from interface:JobEntryValidator
Returns the name of this validator, unique among all validators.- Specified by:
getName
in interfaceJobEntryValidator
- Returns:
- name
-
getKeyValidators
public String getKeyValidators()
-
putValidators
public static ValidatorContext putValidators(JobEntryValidator... validators)
Uses varargs to conveniently add validators to the list of validators consumed byAndValidator
. This method creates and returns a new context.
-
putValidators
public static void putValidators(ValidatorContext context, JobEntryValidator... validators)
Uses varargs to conveniently add validators to the list of validators consumed byAndValidator
. This method adds to an existing map.- See Also:
putValidators(JobEntryValidator[])
-
-