Package org.apache.tapestry5.internal.services

## Class FieldTranslatorImpl<T>

- java.lang.Object
- - org.apache.tapestry5.internal.services.FieldTranslatorImpl<T>

- All Implemented Interfaces:
    `FieldTranslator<T>`

      public class FieldTranslatorImpl<T>
      extends java.lang.Object
      implements FieldTranslator<T>

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `FieldTranslatorImpl​(Field field, Translator<T> translator, MessageFormatter formatter, FormSupport formSupport)` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `java.lang.Class<T>` | `getType()` | Returns the type of the server-side value.
    `T` | `parse​(java.lang.String input)` | Invoked after the client-submitted value has been `translated` to check that the value conforms to expectations (often, in terms of minimum or maximum value).
    `void` | `render​(MarkupWriter writer)` | Invokes `Translator.render(Field, String, MarkupWriter,org.apache.tapestry5.services.FormSupport)`.
    `java.lang.String` | `toClient​(T value)` | Converts a server-side value to a client-side string.

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

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

- - ### Constructor Detail

    - #### FieldTranslatorImpl

          public FieldTranslatorImpl​(Field field,
                                     Translator<T> translator,
                                     MessageFormatter formatter,
                                     FormSupport formSupport)

  - ### Method Detail

    - #### parse

          public T parse​(java.lang.String input)
                  throws ValidationException

      Description copied from interface: `FieldTranslator`
      Invoked after the client-submitted value has been `translated` to check that the value conforms to expectations (often, in terms of minimum or maximum value). If and only if the value is approved by all Validators is the value applied by the field.
      Specified by:
        `parse` in interface `FieldTranslator<T>`
      Throws:
        `ValidationException` - if the value violates the constraint

    - #### render

          public void render​(MarkupWriter writer)

      Description copied from interface: `FieldTranslator`
      Invokes `Translator.render(Field, String, MarkupWriter,org.apache.tapestry5.services.FormSupport)`. This is called at a point "inside" the tag, so that additional attributes may be added. In many cases, the underlying `Validator` may write client-side JavaScript to enforce the constraint as well.
      Specified by:
        `render` in interface `FieldTranslator<T>`
      Parameters:
        `writer` - markup writer to direct output to.
      See Also:
        `MarkupWriter.attributes(Object[])`

    - #### toClient

          public java.lang.String toClient​(T value)

      Description copied from interface: `FieldTranslator`
      Converts a server-side value to a client-side string. This allows for formatting of the value in a way appropriate to the end user.
      Specified by:
        `toClient` in interface `FieldTranslator<T>`
      Parameters:
        `value` - the server side value (which will not be null)
      Returns:
        client-side value to present to the user
      See Also:
        `Translator.toClient(Object)`

    - #### getType

          public java.lang.Class<T> getType()

      Description copied from interface: `FieldTranslator`
      Returns the type of the server-side value.
      Specified by:
        `getType` in interface `FieldTranslator<T>`
      Returns:
        a type