Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.tapestry5.internal.translator
Interface NumericTranslatorSupport

All Known Implementing Classes:
  NumericTranslatorSupportImpl

    public interface NumericTranslatorSupport

Used to generate the client-side JSON specification for how a number-based validator operates. Uses `ThreadLocale` to determine the locale for any locale-specific operations.

Since:
  5.1.0.1

Method Summary
`
`<T extends java.lang.Number> void`
` | `addValidation(java.lang.Class<T> type, Field field, java.lang.String message)` Adds client-side format validation for the field, appropriate to the indicated type.
`
`<T extends java.lang.Number> java.lang.String`
` | `getMessageKey(java.lang.Class<T> type)` Returns the default message key for parse failures for the indicated type.
`
`<T extends java.lang.Number> T`
` | `parseClient(java.lang.Class<T> type, java.lang.String clientValue)` Parses a client-submitted value in a localized manner.
`
`<T extends java.lang.Number> java.lang.String`
` | `toClient(java.lang.Class<T> type, T value)` Converts a server-side value to a client-side string.

Method Detail

### parseClient

    <T extends java.lang.Number> T parseClient(java.lang.Class<T> type,
                                               java.lang.String clientValue)
                                           throws java.text.ParseException

  Parses a client-submitted value in a localized manner.

  Type Parameters:
    `T` -
  Parameters:
    `type` - desired type of value
    `clientValue` - value from client; this will be trimmed of leading/trailing whitespace
  Returns:
    the parsed value
  Throws:
    `java.text.ParseException`
  See Also:
    `Translator.parseClient(org.apache.tapestry5.Field, String, String)`

### toClient

    <T extends java.lang.Number> java.lang.String toClient(java.lang.Class<T> type,
                                                           T value)

  Converts a server-side value to a client-side string. Integer types are formatted simply; decimal types may be formatted using thousands-seperator commas.

  Type Parameters:
    `T` -
  Parameters:
    `type` - type of value to convert
    `value` - current (non-null) value
  Returns:
    value formatted

### getMessageKey

    <T extends java.lang.Number> java.lang.String getMessageKey(java.lang.Class<T> type)

  Returns the default message key for parse failures for the indicated type.

  Type Parameters:
    `T` -
  Parameters:
    `type` -
  Returns:
    a message key: either "integer-format-exception" or "number-format-exception"

### addValidation

    <T extends java.lang.Number> void addValidation(java.lang.Class<T> type,
                                                    Field field,
                                                    java.lang.String message)

  Adds client-side format validation for the field, appropriate to the indicated type.

  Type Parameters:
    `T` -
  Parameters:
    `type` - value type
    `field` - field to which validation should be added
    `message` - message if the client-side value can't be parsed as a number

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2003-2012 The Apache Software Foundation.