class ValidEnumValueOrProfileAttributeValidator implements
        ConstraintValidator<ValidEnumValueOrProfileAttribute, String>, ValidationErrorDescriptorBuilder {

    @Override
    public ErrorDescriptor build(ConstraintViolation violation) {
        return new ErrorDescriptor().setErrorCode(errorCode).setMessage(violation.getPropertyPath()
                + " should be one of " + enumNames.toString() + " or profile attribute placeholder but is ["
                + violation.getInvalidValue() + "]")
                .addProperties(
                        new ClientProperty().setKey("propertyPath").setValue(violation.getPropertyPath().toString()),
                        new ClientProperty().setKey("invalidValue").setValue(violation.getInvalidValue().toString()),
                        new ClientProperty().setKey("allowedValues").setValue(enumNames.toString())
                        );
    }

}