TODO: This should take RepresentationPreferences instead of a type string when supported by Components.js.
Helper function that converts an incoming representation if necessary.
Helper function that converts a Representation using the given args and converter, if the conversion is necessary and there is a converter.
Helper function that checks if the given representation matches the given preferences.
Store that overrides all functions that take or output a Representation, so
getRepresentation
,addResource
, andsetRepresentation
.For incoming representations, they will be converted if an incoming converter and preferences have been set. The converted Representation will be passed along.
For outgoing representations, they will be converted if there is an outgoing converter.
Conversions will only happen if required and will not happen if the Representation is already in the correct format.
In the future this class should take the preferences of the request into account. Even if there is a match with the output from the store, if there is a low weight for that type conversions might still be preferred.