Created
August 16, 2014 10:08
-
-
Save marcus-nl/8c5c6f8472cced934144 to your computer and use it in GitHub Desktop.
Jackson: register subtypes using Reflections
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void registerSubtypes(ObjectMapper objectMapper, Class<?> base) { | |
Reflections reflections = new Reflections(base.getPackage().getName()); | |
Class<?>[] subTypes = reflections.getSubTypesOf(base).toArray(new Class<?>[0]); | |
objectMapper.registerSubtypes(subTypes); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment