-
Notifications
You must be signed in to change notification settings - Fork 76
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 customization of the MapperFactory #228
Conversation
Fixed a deprecation warning from an old method provided by Jackson.
Previously, the fields of the MapperFactory were static. This effectively allowed only a single instance of the object, and also made it impossible to override the createObjectMapper() method with personal customizations like adding serializers/deserializers. The SCIM SDK already treated MapperFactory instances as if they were not static, so we will now permit flexible customization. The documentation makes it clear that the superclass's object mapper must be fetched first for optimal behavior. Reviewer: vyhhuang Reviewer: dougbulkley JiraIssue: DS-49067
var objectMapperBuilder = JsonMapper.builder(new ScimJsonFactory()); | ||
|
||
// Do not care about case when de-serializing POJOs. | ||
objectMapperBuilder.enable(ACCEPT_CASE_INSENSITIVE_PROPERTIES); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The original mapper.configure() call for this property (which I've now deleted) was marked as deprecated by Jackson, so I've updated the logic to instead set the property on the builder class instead. I'm not sure why other setting types (e.g., deserialization features) are okay with setting this directly on an object mapper, but it seems to be what the library encourages.
@@ -68,7 +69,8 @@ protected ScimJsonFactory(@NotNull final ScimJsonFactory sourceFactory, | |||
JsonParser createScimFilterParser(@NotNull final Reader r) | |||
throws IOException | |||
{ | |||
IOContext ctxt = _createContext(r, false); | |||
ContentReference reference = ContentReference.construct(true, r); | |||
IOContext ctxt = _createContext(reference, false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an unrelated change that resolves another deprecation warning. I've kept this in a separate commit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These changes look fine to me.
Previously, the fields of the MapperFactory were static. This
effectively allowed only a single instance of the object, and also made
it impossible to override the createObjectMapper() method with personal
customizations like adding serializers/deserializers. The SCIM SDK
already treated MapperFactory instances as if they were not static, so
we will now permit flexible customization. The documentation makes it
clear that the superclass's object mapper must be fetched first for
optimal behavior.
Reviewer: vyhhuang
Reviewer: dougbulkley
JiraIssue: DS-49067
Resolves #147