public class NumericTranslator<T extends Number> extends AbstractTranslator<T>
NumericTranslatorSupport to provide proper locale-aware
support for all the built-in numeric types.| Constructor and Description |
|---|
NumericTranslator(String name,
Class<T> type,
NumericTranslatorSupport support,
Html5Support html5Support) |
| Modifier and Type | Method and Description |
|---|---|
T |
parseClient(Field field,
String clientValue,
String message)
Converts a submitted request value into an appropriate server side value.
|
void |
render(Field field,
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)). |
String |
toClient(T value)
Converts a server-side value to a client-side string.
|
getMessageKey, getName, getTypepublic NumericTranslator(String name, Class<T> type, NumericTranslatorSupport support, Html5Support html5Support)
public void render(Field field, String message, MarkupWriter writer, FormSupport formSupport)
TranslatorFormSupport.addValidation(Field, String, String, Object)).field - the field which is currently being renderedmessage - formatted validation message, either from validation messages, or from an overridewriter - markup writer, allowing additional attributes to be written into the active elementformSupport - used to add JavaScriptpublic T parseClient(Field field, String clientValue, String message) throws ValidationException
Translatorfield - for which a value is being parsedclientValue - to convert to a server value; this will not be null, but may be blankmessage - formatted validation message, either from validation messages, or from an overrideValidationException - if the value can not be parsedpublic String toClient(T value)
TranslatorTranslator.parseClient(Field, String, String).value - the server side value (which will not be null)5.6.4 - Copyright © 2003-2021 The Apache Software Foundation.