class InstanceOfValidator implements ConstraintValidator<InstanceOf, ClientExpression>, ValidationErrorDescriptorBuilder {

    @Override
    public boolean isValid(ClientExpression value, ConstraintValidatorContext context) {
        if (value == null) return true;
        if (acceptedClasses != null && !acceptedClasses.isEmpty()) {
            for (Class clazz : acceptedClasses) {
                if (clazz.isInstance(value)) {
                    return true;
                }
            }
        }
        return false;
    }

}