class ConstrainedValuesValidator implements PropertyValidator {

    @Override
    public ValidationResult validate(final Object raw) {
        final T value = valueParser.apply(raw);
        return allowedValuesSupplier.get().stream()
                .anyMatch(v -> v.equals(value)) ?
                new ValidationResult(true,
                                     Collections.emptyList()) :
                new ValidationResult(false,
                                     Collections.singletonList(NOT_ALLOWED_VALIDATION_KEY));
    }

    public  ConstrainedValuesValidator(final Supplier<Collection<T>> allowedValuesSupplier,
                                      final Function<Object, T> valueParser);

}