use of com.fasterxml.jackson.databind.jsontype.SubtypeResolver in project jackson-databind by FasterXML.
the class ConfigObjectsTest method testSubtypeResolver.
public void testSubtypeResolver() throws Exception {
ObjectMapper mapper = new ObjectMapper();
SubtypeResolver res = mapper.getSubtypeResolver();
assertTrue(res instanceof StdSubtypeResolver);
StdSubtypeResolver repl = new StdSubtypeResolver();
repl.registerSubtypes(Sub.class);
mapper.setSubtypeResolver(repl);
assertSame(repl, mapper.getSubtypeResolver());
}
use of com.fasterxml.jackson.databind.jsontype.SubtypeResolver in project druid by druid-io.
the class IncrementalIndexCreator method getAppendableIndexTypes.
/**
* Fetch all the available incremental-index implementations.
* It can be used to parametrize the test. If more parameters are needed, use indexTypeCartesianProduct().
* @see #indexTypeCartesianProduct(Collection[]).
*
* @return a list of all the incremental-index implementations types (String)
*/
public static List<String> getAppendableIndexTypes() {
SubtypeResolver resolver = JSON_MAPPER.getSubtypeResolver();
MapperConfig<?> config = JSON_MAPPER.getDeserializationConfig();
AnnotatedClass cls = AnnotatedClassResolver.resolveWithoutSuperTypes(config, AppendableIndexSpec.class);
Collection<NamedType> types = resolver.collectAndResolveSubtypesByClass(config, cls);
return types.stream().map(NamedType::getName).filter(Objects::nonNull).distinct().collect(Collectors.toList());
}
Aggregations