Package org.openfaces.validator

Examples of org.openfaces.validator.CustomValidator


*/
public class ValidateCustomTag extends AbstractCustomValidatorTag {
    @Override
    public void setProperties(AbstractCustomValidator abstractCustomValidator) {
        super.setProperties(abstractCustomValidator);
        CustomValidator customValidator = (CustomValidator) abstractCustomValidator;
        String clientFunction = getPropertyValue("clientFunction");
        customValidator.setClientFunction(clientFunction);
        String serverFunction = getPropertyValue("serverFunction");
        if (serverFunction != null) {
            if (AbstractComponentTag.isValueReference(serverFunction)) {
                Class[] args = {FacesContext.class, UIComponent.class, Object.class};
                FacesContext facesContext = FacesContext.getCurrentInstance();
                MethodExpression methodExpression = createMethodExpression(facesContext, "serverFunction", serverFunction, boolean.class, args);
                Class resultType = methodExpression.getMethodInfo(facesContext.getELContext()).getReturnType();
                if (!resultType.equals(boolean.class))
                    throw new IllegalArgumentException("serverFunction error. Requred return value: boolean. Currently defined: " + resultType);
                customValidator.setServerFunction(methodExpression);
            } else {
                throw new IllegalArgumentException("Invalid value of serverFunction attribute. Must be a value reference. Currently defined: " + serverFunction);
            }
        }

View Full Code Here

TOP

Related Classes of org.openfaces.validator.CustomValidator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.