@Test public void testGetTranslator_typeNone() { Field field = new Field("status", "Status"); field.setClazz(BuildStatusType.class); Translator translator = translateService.getTranslator(field); Assert.assertNull(translator); }
public Translator getTranslator(Field field) { if(Type.class.isAssignableFrom(field.getClazz())) { Type type = (Type)project.getComponent(field.getClazz()); Translator translator = type.getTranslator(); if(translator != null) { return translator; } } if(field.getReferencedType() != null) { return getReferenceTranslator(field.getReferencedType()); } return null; }
TranslateService implements ServerTypeListener { public Translator getTranslator(Field field) { if(Type.class.isAssignableFrom(field.getClazz())) { Type type = (Type)project.getComponent(field.getClazz()); Translator translator = type.getTranslator(); if(translator != null) { return translator; } } if(field.getReferencedType() != null) { return getReferenceTranslator(field.getReferencedType()); } return null; } }
TranslateService implements ServerTypeListener { public Translator getTranslator(Field field) { if(Type.class.isAssignableFrom(field.getClazz())) { Type type = (Type)project.getComponent(field.getClazz()); Translator translator = type.getTranslator(); if(translator != null) { return translator; } } if(field.getReferencedType() != null) { return getReferenceTranslator(field.getReferencedType()); } return null; } TranslateService(Project project, RestService restService); }
TranslateService implements ServerTypeListener { public Translator getTranslator(Field field) { if(Type.class.isAssignableFrom(field.getClazz())) { Type type = (Type)project.getComponent(field.getClazz()); Translator translator = type.getTranslator(); if(translator != null) { return translator; } } if(field.getReferencedType() != null) { return getReferenceTranslator(field.getReferencedType()); } return null; } TranslateService(Project project, RestService restService); boolean isTranslated(Field field); String convertQueryModelToREST(Field field, String value); String convertQueryModelToView(Field field, String value, ValueCallback callback); FilterResolver getFilterResolver(Field field); Translator getTranslator(Field field); Translator getReferenceTranslator(String targetType); String translateAsync(Field field, final String value, boolean syncCall, final ValueCallback onValue); String translateAsync(Translator translator, final String value, boolean syncCall, final ValueCallback onValue); @Override void connectedTo(ServerType serverType); }
TranslateService implements ServerTypeListener { public Translator getTranslator(Field field) { if(Type.class.isAssignableFrom(field.getClazz())) { Type type = (Type)project.getComponent(field.getClazz()); Translator translator = type.getTranslator(); if(translator != null) { return translator; } } if(field.getReferencedType() != null) { return getReferenceTranslator(field.getReferencedType()); } return null; } TranslateService(Project project, RestService restService); boolean isTranslated(Field field); String convertQueryModelToREST(Field field, String value); String convertQueryModelToView(Field field, String value, ValueCallback callback); FilterResolver getFilterResolver(Field field); Translator getTranslator(Field field); Translator getReferenceTranslator(String targetType); String translateAsync(Field field, final String value, boolean syncCall, final ValueCallback onValue); String translateAsync(Translator translator, final String value, boolean syncCall, final ValueCallback onValue); @Override void connectedTo(ServerType serverType); static final String LOADING_MESSAGE; static final String NA_TOKEN; }