class EcoNewsDtoRequestValidator implements ConstraintValidator<ValidEcoNewsDtoRequest, AddEcoNewsDtoRequest> {

    @Override
    public boolean isValid(AddEcoNewsDtoRequest value, ConstraintValidatorContext context) {
        if (value.getSource() != null && !value.getSource().isEmpty()) {
            isUrlValid(value.getSource());
        }
        List<String> tags = value.getTags();
        if (tags.isEmpty() || tags.size() > ValidationConstants.MAX_AMOUNT_OF_TAGS) {
            throw new WrongCountOfTagsException(ErrorMessage.WRONG_COUNT_OF_TAGS_EXCEPTION);
        }
        return true;
    }

}