Package codetroopers.wicket.web.parsley.tagmodifier

Source Code of codetroopers.wicket.web.parsley.tagmodifier.ParsleyMaxTagModifier

package codetroopers.wicket.web.parsley.tagmodifier;

import org.apache.wicket.bean.validation.ITagModifier;
import org.apache.wicket.markup.ComponentTag;
import org.apache.wicket.markup.html.form.FormComponent;

import javax.validation.constraints.Max;

import static codetroopers.wicket.web.parsley.validator.ParsleyNumberValueValidationBehaviors.ParsleyMaxValueValidationBehavior;

/**
* @author cgatay
*/
public class ParsleyMaxTagModifier implements ITagModifier<Max>{
    /**
     * we're using the existing behaviors to keep a correct DRYness
     */
    @Override
    public void modify(final FormComponent<?> component, final ComponentTag tag, final Max annotation) {
        final ParsleyMaxValueValidationBehavior maxValidator = new ParsleyMaxValueValidationBehavior(annotation.value());
        maxValidator.onComponentTag(component, tag);
    }
}
TOP

Related Classes of codetroopers.wicket.web.parsley.tagmodifier.ParsleyMaxTagModifier

TOP
Copyright © 2018 www.massapi.com. 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.