Package org.apache.tapestry5
Interface FieldTranslator<T>
-
- All Known Implementing Classes:
FieldTranslatorImpl
public interface FieldTranslator<T>
A wrapper aroundTranslator
that combines the translator for a specificField
and (sometimes) an override of the default validation message (used when an input value can't be parsed).
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Class<T>
getType()
Returns the type of the server-side value.T
parse(String input)
Invoked after the client-submitted value has beentranslated
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.
-
-
-
Method Detail
-
parse
T parse(String input) throws ValidationException
Invoked after the client-submitted value has beentranslated
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.- Throws:
ValidationException
- if the value violates the constraint
-
toClient
String toClient(T value)
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.- Parameters:
value
- the server side value (which will not be null)- Returns:
- client-side value to present to the user
- See Also:
Translator.toClient(Object)
-
render
void render(MarkupWriter writer)
InvokesTranslator.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 underlyingValidator
may write client-side JavaScript to enforce the constraint as well.- Parameters:
writer
- markup writer to direct output to.- See Also:
MarkupWriter.attributes(Object[])
-
-