org.apache.tapestry5.services
Interface TranslatorSource

All Known Implementing Classes:
TranslatorSourceImpl

@UsesConfiguration(value=Translator.class)
public interface TranslatorSource

A source for Translators, either by name or by property type.

The configuration includes all the translators; each contributed translator must have a unique name.


Method Summary
 Translator findByType(Class valueType)
          Finds a Translator that is appropriate to the given type, which is usually obtained via Binding.getBindingType().
 Translator get(String name)
          Returns the translator with the given logical name.
 Translator getByType(Class valueType)
          Finds a Translator that is appropriate to the given type, which is usually obtained via Binding.getBindingType().
 

Method Detail

get

Translator get(String name)
Returns the translator with the given logical name.

Parameters:
name - name of translator (as configured)
Returns:
the shared translator instance
Throws:
RuntimeException - if no translator is configured for the provided name

findByType

Translator findByType(Class valueType)
Finds a Translator that is appropriate to the given type, which is usually obtained via Binding.getBindingType(). Performs an inheritanced-based search for the best match.

Parameters:
valueType - the type of value for which a default translator is needed
Returns:
the matching translator, or null if no match can be found

getByType

Translator getByType(Class valueType)
Finds a Translator that is appropriate to the given type, which is usually obtained via Binding.getBindingType(). Performs an inheritanced-based search for the best match.

Parameters:
valueType - the type of value for which a default translator is needed
Returns:
the matching translator
Throws:
IllegalArgumentException - if no known validator matches the provided type


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