@Test public void factoryMethodOfIsUsedAsConverter() { ServiceContext serviceContext = ServiceContextManager.getServiceContext(getClass().getClassLoader()); PropertyConverterManager manager = new PropertyConverterManager(serviceContext, true); List<PropertyConverter<MyType>> converters = manager.getPropertyConverters( (TypeLiteral) TypeLiteral.of(MyType.class)); assertThat(converters).hasSize(1); PropertyConverter<MyType> converter = converters.get(0); ConversionContext ctx = new ConversionContext.Builder(TypeLiteral.of(String.class)).build(); Object result = converter.convert("IN", ctx); assertThat(result).isNotNull(); assertThat(result).isInstanceOf(MyType.class); assertThat(((MyType) result).getValue()).isEqualTo("IN"); }
public Map<TypeLiteral<?>, List<PropertyConverter<?>>> getPropertyConverters() { Lock readLock = lock.readLock(); try { readLock.lock(); return new HashMap<>(this.converters); } finally { readLock.unlock(); } }
PropertyConverterManager { public Map<TypeLiteral<?>, List<PropertyConverter<?>>> getPropertyConverters() { Lock readLock = lock.readLock(); try { readLock.lock(); return new HashMap<>(this.converters); } finally { readLock.unlock(); } } }
PropertyConverterManager { public Map<TypeLiteral<?>, List<PropertyConverter<?>>> getPropertyConverters() { Lock readLock = lock.readLock(); try { readLock.lock(); return new HashMap<>(this.converters); } finally { readLock.unlock(); } } PropertyConverterManager(ServiceContext serviceContext);  PropertyConverterManager(ServiceContext serviceContext, boolean init); }
PropertyConverterManager { public Map<TypeLiteral<?>, List<PropertyConverter<?>>> getPropertyConverters() { Lock readLock = lock.readLock(); try { readLock.lock(); return new HashMap<>(this.converters); } finally { readLock.unlock(); } } PropertyConverterManager(ServiceContext serviceContext);  PropertyConverterManager(ServiceContext serviceContext, boolean init); @SuppressWarnings("unchecked") void register(TypeLiteral<T> targetType, PropertyConverter<T> converter); boolean isTargetTypeSupported(TypeLiteral<?> targetType); Map<TypeLiteral<?>, List<PropertyConverter<?>>> getPropertyConverters(); List<PropertyConverter<T>> getPropertyConverters(TypeLiteral<T> targetType); @Override boolean equals(Object o); @Override int hashCode(); }
PropertyConverterManager { public Map<TypeLiteral<?>, List<PropertyConverter<?>>> getPropertyConverters() { Lock readLock = lock.readLock(); try { readLock.lock(); return new HashMap<>(this.converters); } finally { readLock.unlock(); } } PropertyConverterManager(ServiceContext serviceContext);  PropertyConverterManager(ServiceContext serviceContext, boolean init); @SuppressWarnings("unchecked") void register(TypeLiteral<T> targetType, PropertyConverter<T> converter); boolean isTargetTypeSupported(TypeLiteral<?> targetType); Map<TypeLiteral<?>, List<PropertyConverter<?>>> getPropertyConverters(); List<PropertyConverter<T>> getPropertyConverters(TypeLiteral<T> targetType); @Override boolean equals(Object o); @Override int hashCode();  }