@Test public void create_default_translator_with_annotation() { TranslatorSource ts = mockTranslatorSource(); AnnotationProvider ap = mockAnnotationProvider("fred"); Translator t = mockTranslator(); expect(ts.get("fred")).andReturn(t); replay(); FieldTranslatorSourceImpl source = new FieldTranslatorSourceImpl(ts, null, null); assertSame(source.findTranslator(Map.class, ap), t); verify(); }
Translator findTranslator(Class propertyType, AnnotationProvider propertyAnnotations) { Translate annotation = propertyAnnotations.getAnnotation(Translate.class); if (annotation != null) return translatorSource.get(annotation.value()); if (propertyType == null) return null; return translatorSource.findByType(propertyType); }
FieldTranslatorSourceImpl implements FieldTranslatorSource { Translator findTranslator(Class propertyType, AnnotationProvider propertyAnnotations) { Translate annotation = propertyAnnotations.getAnnotation(Translate.class); if (annotation != null) return translatorSource.get(annotation.value()); if (propertyType == null) return null; return translatorSource.findByType(propertyType); } }
FieldTranslatorSourceImpl implements FieldTranslatorSource { Translator findTranslator(Class propertyType, AnnotationProvider propertyAnnotations) { Translate annotation = propertyAnnotations.getAnnotation(Translate.class); if (annotation != null) return translatorSource.get(annotation.value()); if (propertyType == null) return null; return translatorSource.findByType(propertyType); } FieldTranslatorSourceImpl(TranslatorSource translatorSource, Messages globalMessages,
            FormSupport formSupport); }
FieldTranslatorSourceImpl implements FieldTranslatorSource { Translator findTranslator(Class propertyType, AnnotationProvider propertyAnnotations) { Translate annotation = propertyAnnotations.getAnnotation(Translate.class); if (annotation != null) return translatorSource.get(annotation.value()); if (propertyType == null) return null; return translatorSource.findByType(propertyType); } FieldTranslatorSourceImpl(TranslatorSource translatorSource, Messages globalMessages,
            FormSupport formSupport); FieldTranslator createDefaultTranslator(ComponentResources resources, String parameterName); FieldTranslator createDefaultTranslator(Field field, String overrideId, Messages overrideMessages,
            Locale locale, Class propertyType, AnnotationProvider propertyAnnotations); FieldTranslator createTranslator(Field field, String overrideId, Messages overrideMessages, Locale locale,
            Translator translator); FieldTranslator createTranslator(ComponentResources resources, String translatorName); }
FieldTranslatorSourceImpl implements FieldTranslatorSource { Translator findTranslator(Class propertyType, AnnotationProvider propertyAnnotations) { Translate annotation = propertyAnnotations.getAnnotation(Translate.class); if (annotation != null) return translatorSource.get(annotation.value()); if (propertyType == null) return null; return translatorSource.findByType(propertyType); } FieldTranslatorSourceImpl(TranslatorSource translatorSource, Messages globalMessages,
            FormSupport formSupport); FieldTranslator createDefaultTranslator(ComponentResources resources, String parameterName); FieldTranslator createDefaultTranslator(Field field, String overrideId, Messages overrideMessages,
            Locale locale, Class propertyType, AnnotationProvider propertyAnnotations); FieldTranslator createTranslator(Field field, String overrideId, Messages overrideMessages, Locale locale,
            Translator translator); FieldTranslator createTranslator(ComponentResources resources, String translatorName);  }