public class FieldTranslatorImpl<T> extends Object implements FieldTranslator<T>
Constructor and Description |
---|
FieldTranslatorImpl(Field field,
Translator<T> translator,
MessageFormatter formatter,
FormSupport formSupport) |
Modifier and Type | Method and Description |
---|---|
Class<T> |
getType()
Returns the type of the server-side value.
|
T |
parse(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)
|
String |
toClient(T value)
Converts a server-side value to a client-side string.
|
public FieldTranslatorImpl(Field field, Translator<T> translator, MessageFormatter formatter, FormSupport formSupport)
public T parse(String input) throws ValidationException
FieldTranslator
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.parse
in interface FieldTranslator<T>
ValidationException
- if the value violates the constraintpublic void render(MarkupWriter writer)
FieldTranslator
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.render
in interface FieldTranslator<T>
writer
- markup writer to direct output to.MarkupWriter.attributes(Object[])
public String toClient(T value)
FieldTranslator
toClient
in interface FieldTranslator<T>
value
- the server side value (which will not be null)Translator.toClient(Object)
public Class<T> getType()
FieldTranslator
getType
in interface FieldTranslator<T>
5.6.3 - Copyright © 2003-2021 The Apache Software Foundation.