public void setValidator(MethodBinding validatorBinding) {
        Validator[] curValidators = getValidators();
        // see if we need to null-out, or replace an existing validator
        if (null != curValidators) {
            for (int i = 0; i < curValidators.length; i++) {
                // if we want to remove the validatorBinding
                if (null == validatorBinding) {
                    // We are guaranteed to have at most one instance of
                    // MethodBindingValidator in the curValidators
                    // list.
                    if (MethodBindingValidator.class ==
                         curValidators[i].getClass()) {
                        removeValidator(curValidators[i]);
                        return;
                    }
                }
                // if we want to replace the validatorBinding
                else //noinspection ObjectEquality
                    if (validatorBinding == curValidators[i]) {
                    removeValidator(curValidators[i]);
                    break;
                }
            }
        }
        addValidator(new MethodBindingValidator(validatorBinding));

    }
public void setValidator ( MethodBinding validatorBinding ) { Validator [ ] curValidators = getValidators ( ) ; if ( null != curValidators ) { for ( int i = 0 ; i < curValidators . length ; i ++ ) { if ( null == validatorBinding ) { if ( MethodBindingValidator . class == curValidators [ i ] . getClass ( ) ) { removeValidator ( curValidators [ i ] ) ; return ; } } else if ( validatorBinding == curValidators [ i ] ) { removeValidator ( curValidators [ i ] ) ; break ; } } } addValidator ( new MethodBindingValidator ( validatorBinding ) ) ; }
<p>Set a <code>MethodBinding</code> pointing at a
method that will be called during <em>Process Validations</em>
phase of the request processing lifecycle, to validate the current
value of this component.</p>
<p/>
<p>Any method referenced by such an expression must be public, with
a return type of <code>void</code>, and accept parameters of type
{@link FacesContext}, {@link UIComponent}, and <code>Object</code>.</p>

@param validatorBinding The new <code>MethodBinding</code> instance
@deprecated Use {@link #addValidator} instead, obtaining the
argument {@link Validator} by creating an instance of {@link
javax.faces.validator.MethodExpressionValidator}.