@Test public void testConvert() { Ninja ninja = new Ninja(); ninja.setId(1l); ninja.setFirstName("Master"); ninja.setLastName("Roshi"); String source = "1"; Mockito.when(ninjaService.load(source)).thenReturn(ninja); TypeDescriptor targetType = TypeDescriptor.valueOf(Ninja.class); Ninja actual = (Ninja)converter.convert(source, null, targetType); assertNotNull(actual); }
@Override public Object convert(Object source, TypeDescriptor sourceType, TypeDescriptor targetType) { String serviceName = NamingUtil.toAttributeName( NamingUtil.getSimpleName(targetType.getName())) + "Service"; BaseCrudService<?> service = (BaseCrudService<?>) beanFactory.getBean(serviceName); return service.load(source.toString()); }
StringToBaseEntityConverter implements 
		ConditionalGenericConverter, BeanFactoryAware { @Override public Object convert(Object source, TypeDescriptor sourceType, TypeDescriptor targetType) { String serviceName = NamingUtil.toAttributeName( NamingUtil.getSimpleName(targetType.getName())) + "Service"; BaseCrudService<?> service = (BaseCrudService<?>) beanFactory.getBean(serviceName); return service.load(source.toString()); } }
StringToBaseEntityConverter implements 
		ConditionalGenericConverter, BeanFactoryAware { @Override public Object convert(Object source, TypeDescriptor sourceType, TypeDescriptor targetType) { String serviceName = NamingUtil.toAttributeName( NamingUtil.getSimpleName(targetType.getName())) + "Service"; BaseCrudService<?> service = (BaseCrudService<?>) beanFactory.getBean(serviceName); return service.load(source.toString()); }  }
StringToBaseEntityConverter implements 
		ConditionalGenericConverter, BeanFactoryAware { @Override public Object convert(Object source, TypeDescriptor sourceType, TypeDescriptor targetType) { String serviceName = NamingUtil.toAttributeName( NamingUtil.getSimpleName(targetType.getName())) + "Service"; BaseCrudService<?> service = (BaseCrudService<?>) beanFactory.getBean(serviceName); return service.load(source.toString()); }  @Override Set<ConvertiblePair> getConvertibleTypes(); @Override Object convert(Object source, TypeDescriptor sourceType, TypeDescriptor targetType); @Override boolean matches(TypeDescriptor sourceType, TypeDescriptor targetType); final void setBeanFactory(BeanFactory beanFactory); final void setBaseEntityRegistry(BaseEntityRegistry baseEntityRegistry); }
StringToBaseEntityConverter implements 
		ConditionalGenericConverter, BeanFactoryAware { @Override public Object convert(Object source, TypeDescriptor sourceType, TypeDescriptor targetType) { String serviceName = NamingUtil.toAttributeName( NamingUtil.getSimpleName(targetType.getName())) + "Service"; BaseCrudService<?> service = (BaseCrudService<?>) beanFactory.getBean(serviceName); return service.load(source.toString()); }  @Override Set<ConvertiblePair> getConvertibleTypes(); @Override Object convert(Object source, TypeDescriptor sourceType, TypeDescriptor targetType); @Override boolean matches(TypeDescriptor sourceType, TypeDescriptor targetType); final void setBeanFactory(BeanFactory beanFactory); final void setBaseEntityRegistry(BaseEntityRegistry baseEntityRegistry);  }