org.apache.tapestry.form.translator
Interface Translator

All Superinterfaces:
FormComponentContributor
All Known Implementing Classes:
AbstractTranslator, BigDecimalTranslator, DateTranslator, FormatTranslator, NumberTranslator, StringTranslator

public interface Translator
extends FormComponentContributor

Interface used by ValidatableFields to both format an object as text and translate submitted text into an appropriate object for a given field.

Since:
4.0
Author:
Paul Ferraro

Method Summary
 String format(IFormComponent field, Locale locale, Object object)
          Invoked during rendering to format an object (which may be null) into a text value (which should not be null) appropriate for the specified field.
 Object parse(IFormComponent field, ValidationMessages messages, String value)
          Invoked during rewind to parse a submitted input value into an object suitable for the specified component.
 
Methods inherited from interface org.apache.tapestry.form.FormComponentContributor
renderContribution
 

Method Detail

format

String format(IFormComponent field,
              Locale locale,
              Object object)
Invoked during rendering to format an object (which may be null) into a text value (which should not be null) appropriate for the specified field.

Parameters:
locale - TODO

parse

Object parse(IFormComponent field,
             ValidationMessages messages,
             String value)
             throws ValidatorException
Invoked during rewind to parse a submitted input value into an object suitable for the specified component.

Parameters:
messages - TODO
Returns:
the parsed object
Throws:
ValidatorException - if the specified text could not be parsed into an object.


Copyright © 2006-2008 Apache Software Foundation. All Rights Reserved.