class ResourceReferencesValidator implements ConstraintValidator<ValidResourceReferences, Map<String, ClientReferenceableFile>>, ValidationErrorDescriptorBuilder {

    @Override
    public ErrorDescriptor build(ConstraintViolation violation) {
        @SuppressWarnings("unchecked")
        List<String> invalidReferences = findInvalidReferences((Map) violation.getInvalidValue());
        ErrorDescriptor errorDescriptor = new ErrorDescriptor().setErrorCode(ValidResourceReferences.ERROR_CODE)
                .setMessage("The mandatory parameter \"" + MANDATORY_PARAMETER + "\" is missing.");

        for (String invalidReference : invalidReferences) {
            errorDescriptor.addProperties(new ClientProperty().setKey(ValidResourceReferences.PROPERTY_INVALID_REFERENCE)
                    .setValue("" + violation.getPropertyPath() + "." + invalidReference));
        }
        return errorDescriptor;
    }

}