Package com.kenshoo.pl.entity.spi
Interface FieldsCombinationValidator<E extends EntityType<E>>
-
- All Superinterfaces:
ChangeValidator
public interface FieldsCombinationValidator<E extends EntityType<E>> extends ChangeValidator
A validator that verifies that the resulting state of several fields is legal, no matter whether some of them are already set or being modified by the command. For instance, if a validator validates that the value of field 'B' is greater than the value of field 'A', it is going to be called when either 'B' or 'A' (or both) are being changed.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interfaceFieldsCombinationValidator.Substitution<E extends EntityType<E>,T>
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default java.util.stream.Stream<EntityField<?,?>>fetchFields()default java.util.stream.Stream<FieldsCombinationValidator.Substitution<E,?>>substitutions()ValidationErrorvalidate(FieldsValueMap<E> fieldsValueMap)Implements the validation and return an error if there is.java.util.stream.Stream<EntityField<E,?>>validatedFields()default java.util.function.Predicate<CurrentEntityState>validateWhen()
-
-
-
Method Detail
-
validatedFields
java.util.stream.Stream<EntityField<E,?>> validatedFields()
- Returns:
- the list of fields whose combination is being validated
-
validate
ValidationError validate(FieldsValueMap<E> fieldsValueMap)
Implements the validation and return an error if there is.- Parameters:
fieldsValueMap- the map containing the fields specified byvalidatedFields(). If a field is being modified by the command, its new value is going to be in the map, otherwise the existing value would be passed.- Returns:
- validation error if there is or
nullif OK
-
fetchFields
default java.util.stream.Stream<EntityField<?,?>> fetchFields()
- Returns:
- a list of fields to fetch.
-
validateWhen
default java.util.function.Predicate<CurrentEntityState> validateWhen()
- Returns:
- Predicate when should validate fields.
-
substitutions
default java.util.stream.Stream<FieldsCombinationValidator.Substitution<E,?>> substitutions()
- Returns:
- a field's substitutions.
-
-