Class TranslatorSourceImpl
- java.lang.Object
-
- org.apache.tapestry5.internal.services.TranslatorSourceImpl
-
- All Implemented Interfaces:
java.lang.Runnable,TranslatorSource
public class TranslatorSourceImpl extends java.lang.Object implements TranslatorSource, java.lang.Runnable
-
-
Constructor Summary
Constructors Constructor Description TranslatorSourceImpl(java.util.Map<java.lang.Class,Translator> configuration)TranslatorSourceImpl(java.util.Map<java.lang.Class,Translator> configuration, java.util.Map<java.lang.String,Translator> alternates)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TranslatorfindByType(java.lang.Class valueType)Finds aTranslatorthat is appropriate to the given type, which is usually obtained viaBinding.getBindingType().Translatorget(java.lang.String name)Returns the translator with the given name (either a standard translator, or an alternate).TranslatorgetByType(java.lang.Class valueType)Finds aTranslatorthat is appropriate to the given type, which is usually obtained viaBinding.getBindingType().voidrun()Invoked by InvalidationEventHub
-
-
-
Constructor Detail
-
TranslatorSourceImpl
public TranslatorSourceImpl(java.util.Map<java.lang.Class,Translator> configuration)
-
TranslatorSourceImpl
public TranslatorSourceImpl(java.util.Map<java.lang.Class,Translator> configuration, java.util.Map<java.lang.String,Translator> alternates)
-
-
Method Detail
-
get
public Translator get(java.lang.String name)
Description copied from interface:TranslatorSourceReturns the translator with the given name (either a standard translator, or an alternate).- Specified by:
getin interfaceTranslatorSource- Parameters:
name- name of translator (as configured, but case is ignored)- Returns:
- the shared translator instance
-
getByType
public Translator getByType(java.lang.Class valueType)
Description copied from interface:TranslatorSourceFinds aTranslatorthat is appropriate to the given type, which is usually obtained viaBinding.getBindingType(). Performs an inheritance-based search for the best match, among the standard translators (not alternates).- Specified by:
getByTypein interfaceTranslatorSource- Parameters:
valueType- the type of value for which a default translator is needed- Returns:
- the matching translator
-
findByType
public Translator findByType(java.lang.Class valueType)
Description copied from interface:TranslatorSourceFinds aTranslatorthat is appropriate to the given type, which is usually obtained viaBinding.getBindingType(). Performs an inheritance-based search for the best match, among the standard translator (not alternates).- Specified by:
findByTypein interfaceTranslatorSource- 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
-
run
public void run()
Invoked by InvalidationEventHub- Specified by:
runin interfacejava.lang.Runnable
-
-