package it.mice.voila.runtime.validator;

import org.springframework.context.support.DefaultMessageSourceResolvable;
import org.springframework.stereotype.Component;
import org.springframework.validation.DefaultBindingErrorProcessor;

@Component
public class BindingErrorProcessor extends DefaultBindingErrorProcessor {

	@Override
	protected Object[] getArgumentsForBindError(String objectName, String field) {
		String[] codes = ValidatorUtils.getCodes(objectName, field);
		return new Object[] {new DefaultMessageSourceResolvable(codes, field)};
	}

}
