org.apache.wicket.bean.validation
Class PropertyValidator<T>

java.lang.Object
  extended by org.apache.wicket.behavior.Behavior
      extended by org.apache.wicket.bean.validation.PropertyValidator<T>
Type Parameters:
T -
All Implemented Interfaces:
Serializable, IComponentAwareEventSink, IComponentAwareHeaderContributor, org.apache.wicket.util.io.IClusterable, IValidator<T>

public class PropertyValidator<T>
extends Behavior
implements IValidator<T>

Validator that delegates to the bean validation framework. The integration has to be first configured using BeanValidationConfiguration.

The validator must be provided a Property, unless one can be resolved from the component implicitly. By default the configuration contains the DefaultPropertyResolver so PropertyModels are supported out of the box - when attached to a component with a property model the property does not need to be specified explicitly.

The validator will set the required flag on the form component it is attached to based on the presence of the @NotNull annotation. Notice, the required flag will only be set to true, components with the required flag already set to true will not have the flag set to false by this validator.

The validator will allow ITagModifiers configured in BeanValidationConfiguration to mutate the markup tag of the component it is attached to.

The validator specifies default error messages in the PropertyValidator.properties file. These values can be overridden in the application subclass' property files globally or in the page or panel properties locally. See this file for the default messages supported.

Author:
igor
See Also:
Serialized Form

Constructor Summary
PropertyValidator(Class<?>... groups)
           
PropertyValidator(IModel<Class<?>[]> groups)
           
PropertyValidator(Property property, Class<?>... groups)
           
PropertyValidator(Property property, IModel<Class<?>[]> groups)
           
 
Method Summary
 void bind(Component component)
           
 void detach(Component component)
           
 void onComponentTag(Component component, ComponentTag tag)
           
 void onConfigure(Component component)
           
 void validate(IValidatable<T> validatable)
           
 
Methods inherited from class org.apache.wicket.behavior.Behavior
afterRender, beforeRender, canCallListenerInterface, getStatelessHint, isEnabled, isTemporary, onEvent, onException, onRemove, renderHead, unbind
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PropertyValidator

public PropertyValidator(Class<?>... groups)

PropertyValidator

public PropertyValidator(IModel<Class<?>[]> groups)

PropertyValidator

public PropertyValidator(Property property,
                         Class<?>... groups)

PropertyValidator

public PropertyValidator(Property property,
                         IModel<Class<?>[]> groups)
Method Detail

bind

public void bind(Component component)
Overrides:
bind in class Behavior

onConfigure

public void onConfigure(Component component)
Overrides:
onConfigure in class Behavior

detach

public void detach(Component component)
Overrides:
detach in class Behavior

onComponentTag

public void onComponentTag(Component component,
                           ComponentTag tag)
Overrides:
onComponentTag in class Behavior

validate

public void validate(IValidatable<T> validatable)
Specified by:
validate in interface IValidator<T>


Copyright © 2006–2016 Apache Software Foundation. All rights reserved.