org.apache.tapestry5.internal.translator

## Class NumericTranslator<T extends java.lang.Number>

- java.lang.Object
- - org.apache.tapestry5.internal.translator.AbstractTranslator<T>
  - - org.apache.tapestry5.internal.translator.NumericTranslator<T>

- All Implemented Interfaces:
    Translator<T>

      public class NumericTranslator<T extends java.lang.Number>
      extends AbstractTranslator<T>

  Uses a `NumericTranslatorSupport` to provide proper locale-aware support for all the built-in numeric types.
  Since:
    5.1.0.1

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `NumericTranslator(java.lang.String name, java.lang.Class<T> type, NumericTranslatorSupport support, Html5Support html5Support)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `T` | `parseClient(Field field, java.lang.String clientValue, java.lang.String message)` Converts a submitted request value into an appropriate server side value.
    `void` | `render(Field field, java.lang.String message, MarkupWriter writer, FormSupport formSupport)` Hook used by components to allow the validator to contribute additional attributes or (more often) client-side JavaScript (via the `FormSupport.addValidation(Field, String, String, Object)`).
    `java.lang.String` | `toClient(T value)` Converts a server-side value to a client-side string.

    - ### Methods inherited from class org.apache.tapestry5.internal.translator.AbstractTranslator

      `getMessageKey, getName, getType`

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

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

- - ### Constructor Detail

    - #### NumericTranslator

          public NumericTranslator(java.lang.String name,
                                   java.lang.Class<T> type,
                                   NumericTranslatorSupport support,
                                   Html5Support html5Support)

  - ### Method Detail

    - #### render

          public void render(Field field,
                             java.lang.String message,
                             MarkupWriter writer,
                             FormSupport formSupport)

      Description copied from interface: `Translator`
      Hook used by components to allow the validator to contribute additional attributes or (more often) client-side JavaScript (via the `FormSupport.addValidation(Field, String, String, Object)`).
      Parameters:
        `field` - the field which is currently being rendered
        `message` - formatted validation message, either from validation messages, or from an override
        `writer` - markup writer, allowing additional attributes to be written into the active element
        `formSupport` - used to add JavaScript

    - #### parseClient

          public T parseClient(Field field,
                               java.lang.String clientValue,
                               java.lang.String message)
                        throws ValidationException

      Description copied from interface: `Translator`
      Converts a submitted request value into an appropriate server side value.
      Parameters:
        `field` - for which a value is being parsed
        `clientValue` - to convert to a server value; this will not be null, but may be blank
        `message` - formatted validation message, either from validation messages, or from an override
      Returns:
        equivalent server-side value (possibly null)
      Throws:
        `ValidationException` - if the value can not be parsed

    - #### toClient

          public java.lang.String toClient(T value)

      Description copied from interface: `Translator`
      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. The output client value should be parsable by `Translator.parseClient(Field, String, String)`.
      Parameters:
        `value` - the server side value (which will not be null)
      Returns:
        client-side value to present to the user

${project.version} - Copyright © 2003-2015 The Apache Software Foundation.