T
- public class PropertyValidator<T> extends Behavior implements INullAcceptingValidator<T>
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
PropertyModel
s 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 ITagModifier
s 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.
Constructor and Description |
---|
PropertyValidator(Class<?>... groups) |
PropertyValidator(IModel<Class<?>[]> groups) |
PropertyValidator(Property property,
Class<?>... groups) |
PropertyValidator(Property property,
IModel<Class<?>[]> groups) |
Modifier and Type | Method and Description |
---|---|
void |
bind(Component component)
Bind this handler to the given component.
|
void |
detach(Component component)
Allows the behavior to detach any state it has attached during request processing.
|
protected boolean |
isRequired()
Should this property make the owning component required.
|
void |
onComponentTag(Component component,
ComponentTag tag)
Called any time a component that has this behavior registered is rendering the component tag.
|
void |
onConfigure(Component component)
Called immediately after the onConfigure method in a component.
|
void |
validate(IValidatable<T> validatable)
Validates the
IValidatable instance. |
afterRender, beforeRender, canCallListener, getStatelessHint, isEnabled, isTemporary, onAttribute, onEvent, onException, onRemove, onTag, renderHead, unbind
public PropertyValidator(Class<?>... groups)
public void bind(Component component)
Behavior
public void onConfigure(Component component)
Behavior
onConfigure
in class Behavior
component
- the component being configuredpublic void detach(Component component)
Behavior
protected boolean isRequired()
true
if requiredBeanValidationContext.isRequiredConstraint(ConstraintDescriptor)
public void onComponentTag(Component component, ComponentTag tag)
Behavior
onComponentTag
in class Behavior
component
- the component that renders this tag currentlytag
- the tag that is renderedpublic void validate(IValidatable<T> validatable)
IValidator
IValidatable
instance. Validation errors should be reported using
the IValidatable.error(IValidationError)
method.validate
in interface IValidator<T>
validatable
- the IValidatable
instance being validatedCopyright © 2006–2022 Apache Software Foundation. All rights reserved.