You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
No problem. Just an observation.
Describe the solution you'd like
Right now com.adobe.cq.wcm.core.components.internal.models.v1.datalayer.ComponentDataImpl#getJson constructs a new ObjectMapper for each invocation of the method.
Additionally, the configuration of the serializer in com.adobe.cq.wcm.core.components.models.Component#getData should be moved inside of com.adobe.cq.wcm.core.components.internal.models.v1.datalayer.ComponentDataImpl#getJson because right now a build-warning is generated since ComponentData is part of the public API (inside Export-Package) but com.adobe.cq.wcm.core.components.internal.jackson.ComponentDataModelSerializer is inside internal.
Are there alternatives?
The construction per invocation of getJsonis unnecessary as ObjectMapper is thread-safe (as long as no configuration changes occur after constructing the object).
Alternatively or even better we can switch to ObjectWriter since we only use Jackson to serialize the Data for the JavaScript to consume as ObjectWriter is guaranteed to be immutable.
Documentation
The text was updated successfully, but these errors were encountered:
dhardtke
added a commit
to dhardtke/aem-core-wcm-components
that referenced
this issue
Feb 6, 2021
Feature Request
Is your feature request related to a problem? Please describe.
No problem. Just an observation.
Describe the solution you'd like
Right now
com.adobe.cq.wcm.core.components.internal.models.v1.datalayer.ComponentDataImpl#getJson
constructs a newObjectMapper
for each invocation of the method.Additionally, the configuration of the serializer in
com.adobe.cq.wcm.core.components.models.Component#getData
should be moved inside ofcom.adobe.cq.wcm.core.components.internal.models.v1.datalayer.ComponentDataImpl#getJson
because right now a build-warning is generated sinceComponentData
is part of the public API (inside Export-Package) butcom.adobe.cq.wcm.core.components.internal.jackson.ComponentDataModelSerializer
is insideinternal
.Are there alternatives?
The construction per invocation of
getJson
is unnecessary as ObjectMapper is thread-safe (as long as no configuration changes occur after constructing the object).Alternatively or even better we can switch to
ObjectWriter
since we only use Jackson to serialize the Data for the JavaScript to consume asObjectWriter
is guaranteed to be immutable.Documentation
The text was updated successfully, but these errors were encountered: