public class NumericTranslatorSupportImpl extends Object implements NumericTranslatorSupport
Constructor and Description |
---|
NumericTranslatorSupportImpl(TypeCoercer typeCoercer,
ThreadLocale threadLocale,
JavaScriptSupport javascriptSupport) |
Modifier and Type | Method and Description |
---|---|
<T extends Number> |
getMessageKey(Class<T> type)
Returns the default message key for parse failures for the indicated type.
|
<T extends Number> |
parseClient(Class<T> type,
String clientValue)
Parses a client-submitted value in a localized manner.
|
<T extends Number> |
setupTranslation(Class<T> type,
Element element,
String message)
Adds client-side format validation for the field, appropriate to the indicated type.
|
<T extends Number> |
toClient(Class<T> type,
T value)
Converts a server-side value to a client-side string.
|
public NumericTranslatorSupportImpl(TypeCoercer typeCoercer, ThreadLocale threadLocale, JavaScriptSupport javascriptSupport)
public <T extends Number> void setupTranslation(Class<T> type, Element element, String message)
NumericTranslatorSupport
setupTranslation
in interface NumericTranslatorSupport
type
- value typemessage
- message if the client-side value can't be parsed as a numberpublic <T extends Number> T parseClient(Class<T> type, String clientValue) throws ParseException
NumericTranslatorSupport
parseClient
in interface NumericTranslatorSupport
type
- desired type of valueclientValue
- value from client; this will be trimmed of leading/trailing whitespaceParseException
Translator.parseClient(org.apache.tapestry5.Field, String, String)
public <T extends Number> String toClient(Class<T> type, T value)
NumericTranslatorSupport
toClient
in interface NumericTranslatorSupport
type
- type of value to convertvalue
- current (non-null) valuepublic <T extends Number> String getMessageKey(Class<T> type)
NumericTranslatorSupport
getMessageKey
in interface NumericTranslatorSupport
5.6.3 - Copyright © 2003-2021 The Apache Software Foundation.