-
Notifications
You must be signed in to change notification settings - Fork 284
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for configs polymorphism #14
Labels
Milestone
Comments
andrus
added a commit
that referenced
this issue
Feb 8, 2016
Added unit tests. The feature itself is built into Jackson, so not assigning this to any particular release. |
Reopening... Enumerating subclasses with @JsonSubTypes annotation is completely inflexible. Dropwizard has a rather ingenious approach - combining Jackson with ServiceLoader mechanism and a tag interface for all polymorphic factory classes. We should use something similar. |
andrus
changed the title
Support for configs polimorphism
Support for configs polymorphism
Feb 24, 2016
andrus
added a commit
that referenced
this issue
Feb 25, 2016
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Jackson supports polymorphic type resolution for configuration based on a value of a specific property in YAML (e.g. type: mytype). A supertype (or interface) is annotated with
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "xyz")
and concrete subclasses - with@JsonTypeName("abc")
. This is great for dynamic configurations where each possible subclass has different set of properties. (E.g. FileAppender vs. ConsoleAppender).Current workaround is to use Map<String, String> and manually binding properties.
The text was updated successfully, but these errors were encountered: