public class FieldValidationSupportImpl extends Object implements FieldValidationSupport
Constructor and Description |
---|
FieldValidationSupportImpl(TypeCoercer typeCoercer,
PropertyAccess propertyAccess) |
Modifier and Type | Method and Description |
---|---|
Object |
parseClient(String clientValue,
ComponentResources componentResources,
FieldTranslator<Object> translator,
NullFieldStrategy nullFieldStrategy)
A wrapper around
Translator.parseClient(Field, String, String) . |
String |
toClient(Object value,
ComponentResources componentResources,
FieldTranslator<Object> translator,
NullFieldStrategy nullFieldStrategy)
A wrapper around
Translator.toClient(Object) that first fires a "toclient" event on
the component to see if it can perform the conversion. |
void |
validate(Object value,
ComponentResources componentResources,
FieldValidator validator)
Performs validation on a parsed value from the client.
|
public FieldValidationSupportImpl(TypeCoercer typeCoercer, PropertyAccess propertyAccess)
public String toClient(Object value, ComponentResources componentResources, FieldTranslator<Object> translator, NullFieldStrategy nullFieldStrategy)
FieldValidationSupport
Translator.toClient(Object)
that first fires a "toclient" event on
the component to see if it can perform the conversion. If the value is null, then no event is fired and the
translator is not invoked, the return value is simply null.toClient
in interface FieldValidationSupport
value
- to be converted to a client-side string, which may be nullcomponentResources
- used to fire events on the componenttranslator
- used if the component does not provide a non-null valuenullFieldStrategy
- used to convert a null server side value to an appropriate client side valueTranslator.toClient(Object)
public Object parseClient(String clientValue, ComponentResources componentResources, FieldTranslator<Object> translator, NullFieldStrategy nullFieldStrategy) throws ValidationException
FieldValidationSupport
Translator.parseClient(Field, String, String)
. First a "parseclient" event is fired; the
translator is only invoked if that returns null (typically because there is no event handler method for the
event).parseClient
in interface FieldValidationSupport
clientValue
- the value provided by the client (not null)componentResources
- used to trigger eventstranslator
- translator that will do the work if the component event returns nullnullFieldStrategy
- used to convert null/blank values from client into non-null server side valuesValidationException
- if the value can't be parsedTranslator.parseClient(Field, String, String)
public void validate(Object value, ComponentResources componentResources, FieldValidator validator) throws ValidationException
FieldValidationSupport
validate
in interface FieldValidationSupport
value
- parsed value from the client, possibly nullcomponentResources
- used to trigger eventsvalidator
- performs normal validationsValidationException
- if the value is not validValidator.validate(Field, Object, org.apache.tapestry5.ioc.MessageFormatter, Object)
${project.version} - Copyright © 2003-2015 The Apache Software Foundation.