K
K
Kirill Toklachev2015-02-09 20:53:35
Java
Kirill Toklachev, 2015-02-09 20:53:35

Jackson2. How to get a list of loaded types?

Background: Made simple type typing with Jackson2

TypeResolverBuilder<?> typeBuilder = new ObjectMapper.DefaultTypeResolverBuilder(ObjectMapper.DefaultTyping.JAVA_LANG_OBJECT);
        typeBuilder = typeBuilder.init(JsonTypeInfo.Id.NAME, null);
        typeBuilder = typeBuilder.inclusion(JsonTypeInfo.As.PROPERTY);
        typeBuilder = typeBuilder.typeProperty("@type");

Now all responses contain a class name or a predefined object name.
Task: Display to the user all supported types
Is it possible to get through the Jackson2 API (or its classes in spring-web) the entire list of types that Jackson2 has processed?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question