This would allow users more control over the Gson object.
For example, Gson does not have a default adapter for the Path type. Path is an interface, so with only the exposed registerTypeAdapter() method, separate adapters would need to be registered for each different implementation of Path even though basically every Path implementation should have the same JSON serialized representation.
Exposing the registerTypeHierarchyAdapter() method allows users to handle this situation more gracefully by only having to register a single adapter for the parent type.
registerTypeAdapterFactory() can be used in similar situations.
This would allow users more control over the Gson object. For example, Gson does not have a default adapter for the
Path
type.Path
is an interface, so with only the exposedregisterTypeAdapter()
method, separate adapters would need to be registered for each different implementation ofPath
even though basically everyPath
implementation should have the same JSON serialized representation.Exposing the
registerTypeHierarchyAdapter()
method allows users to handle this situation more gracefully by only having to register a single adapter for the parent type.registerTypeAdapterFactory()
can be used in similar situations.