Package org.apache.tapestry5.internal.services

## Class FieldValidationSupportImpl

- java.lang.Object
- - org.apache.tapestry5.internal.services.FieldValidationSupportImpl

- All Implemented Interfaces:
    `FieldValidationSupport`

      public class FieldValidationSupportImpl
      extends java.lang.Object
      implements FieldValidationSupport

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `FieldValidationSupportImpl​(TypeCoercer typeCoercer, PropertyAccess propertyAccess)` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `java.lang.Object` | `parseClient​(java.lang.String clientValue, ComponentResources componentResources, FieldTranslator<java.lang.Object> translator, NullFieldStrategy nullFieldStrategy)` | A wrapper around `Translator.parseClient(Field, String, String)`.
    `java.lang.String` | `toClient​(java.lang.Object value, ComponentResources componentResources, FieldTranslator<java.lang.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​(java.lang.Object value, ComponentResources componentResources, FieldValidator validator)` | Performs validation on a parsed value from the client.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### FieldValidationSupportImpl

          public FieldValidationSupportImpl​(TypeCoercer typeCoercer,
                                            PropertyAccess propertyAccess)

  - ### Method Detail

    - #### toClient

          public java.lang.String toClient​(java.lang.Object value,
                                           ComponentResources componentResources,
                                           FieldTranslator<java.lang.Object> translator,
                                           NullFieldStrategy nullFieldStrategy)

      Description copied from interface: `FieldValidationSupport`
      A wrapper around `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.
      Specified by:
        `toClient` in interface `FieldValidationSupport`
      Parameters:
        `value` - to be converted to a client-side string, which may be null
        `componentResources` - used to fire events on the component
        `translator` - used if the component does not provide a non-null value
        `nullFieldStrategy` - used to convert a null server side value to an appropriate client side value
      Returns:
        the translated value or null if the value is null
      See Also:
        `Translator.toClient(Object)`

    - #### parseClient

          public java.lang.Object parseClient​(java.lang.String clientValue,
                                              ComponentResources componentResources,
                                              FieldTranslator<java.lang.Object> translator,
                                              NullFieldStrategy nullFieldStrategy)
                                       throws ValidationException

      Description copied from interface: `FieldValidationSupport`
      A wrapper around `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).
      Specified by:
        `parseClient` in interface `FieldValidationSupport`
      Parameters:
        `clientValue` - the value provided by the client (not null)
        `componentResources` - used to trigger events
        `translator` - translator that will do the work if the component event returns null
        `nullFieldStrategy` - used to convert null/blank values from client into non-null server side values
      Returns:
        the input parsed to an object
      Throws:
        `ValidationException` - if the value can't be parsed
      See Also:
        `Translator.parseClient(Field, String, String)`

    - #### validate

          public void validate​(java.lang.Object value,
                               ComponentResources componentResources,
                               FieldValidator validator)
                        throws ValidationException

      Description copied from interface: `FieldValidationSupport`
      Performs validation on a parsed value from the client. Normal validations occur first, then a "validate" event is triggered on the component.
      Specified by:
        `validate` in interface `FieldValidationSupport`
      Parameters:
        `value` - parsed value from the client, possibly null
        `componentResources` - used to trigger events
        `validator` - performs normal validations
      Throws:
        `ValidationException` - if the value is not valid
      See Also:
        `Validator.validate(Field, Object, org.apache.tapestry5.ioc.MessageFormatter, Object)`