Interface FieldComplexValidator<E extends EntityType<E>,​T>

  • Type Parameters:
    E - entity type
    T - data type of the field being validated
    All Superinterfaces:
    ChangeValidator

    public interface FieldComplexValidator<E extends EntityType<E>,​T>
    extends ChangeValidator
    A validator that checks one field and uses parent entity fields for the verification. For instance, a validator that checks that a bid doesn't exceed campaign budget, would implement this interface.
    • Method Detail

      • validatedField

        EntityField<E,​T> validatedField()
        Returns:
        the field validated by this validator
      • validate

        ValidationError validate​(T fieldValue,
                                 CurrentEntityState currentState)
        Called by the framework to validate the value. The implementation can query the entity only for the fields it has declared in fetchFields().
        Parameters:
        fieldValue - new value of the field
        currentState - existing entity
        Returns:
        a validation error if any, null if none
      • fetchFields

        java.util.stream.Stream<EntityField<?,​?>> fetchFields()
        Returns:
        a list of fields to fetch. Can contain only parent entities fields.