@Test public void testConverter_Enum() { JsonValueConverter<?> c1 = mock(JsonValueConverter.class); JsonValueConverter<?> c2 = mock(JsonValueConverter.class); DefaultJsonValueConverterFactory factory = new DefaultJsonValueConverterFactory(Collections.emptyMap(), c2); assertSame(c2, factory.converter(Object.class)); JsonValueConverter<?> e1c = factory.converter(E1.class); assertTrue(e1c instanceof EnumConverter); assertSame(E1.class, ((EnumConverter) e1c).getEnumType()); JsonValueConverter<?> e2c = factory.converter(E2.class); assertTrue(e2c instanceof EnumConverter); assertSame(E2.class, ((EnumConverter) e2c).getEnumType()); assertSame(e1c, factory.converter(E1.class)); }
@Override public JsonValueConverter<?> converter(Type valueType) { return getOrCreateConverter(valueType, () -> buildOrDefault(valueType)); }
DefaultJsonValueConverterFactory implements IJsonValueConverterFactory { @Override public JsonValueConverter<?> converter(Type valueType) { return getOrCreateConverter(valueType, () -> buildOrDefault(valueType)); } }
DefaultJsonValueConverterFactory implements IJsonValueConverterFactory { @Override public JsonValueConverter<?> converter(Type valueType) { return getOrCreateConverter(valueType, () -> buildOrDefault(valueType)); } DefaultJsonValueConverterFactory(Map<Class<?>, JsonValueConverter<?>> knownConverters,
                                            JsonValueConverter<?> defaultConverter); }
DefaultJsonValueConverterFactory implements IJsonValueConverterFactory { @Override public JsonValueConverter<?> converter(Type valueType) { return getOrCreateConverter(valueType, () -> buildOrDefault(valueType)); } DefaultJsonValueConverterFactory(Map<Class<?>, JsonValueConverter<?>> knownConverters,
                                            JsonValueConverter<?> defaultConverter); @Override JsonValueConverter<?> converter(Type valueType); @SuppressWarnings("unchecked") @Override Optional<JsonValueConverter<T>> typedConverter(Class<T> valueType); }
DefaultJsonValueConverterFactory implements IJsonValueConverterFactory { @Override public JsonValueConverter<?> converter(Type valueType) { return getOrCreateConverter(valueType, () -> buildOrDefault(valueType)); } DefaultJsonValueConverterFactory(Map<Class<?>, JsonValueConverter<?>> knownConverters,
                                            JsonValueConverter<?> defaultConverter); @Override JsonValueConverter<?> converter(Type valueType); @SuppressWarnings("unchecked") @Override Optional<JsonValueConverter<T>> typedConverter(Class<T> valueType);  }