gooddata_sdk.type_converter.TypeConverterRegistry
- class gooddata_sdk.type_converter.TypeConverterRegistry(type_name: str)
Bases:
object
Class stores converters for given type with ability to distinguish converters based on sub-type granularity.
- __init__(type_name: str)
Initialize instance with type for which instance is going to be responsible :param type_name: type name
Methods
__init__
(type_name)Initialize instance with type for which instance is going to be responsible :param type_name: type name
converter
(sub_type)Find and return converter instance for a given sub-type.
register
(converter, sub_type)Register converter instance for given sub-type (granularity).
- converter(sub_type: Optional[str]) Converter
Find and return converter instance for a given sub-type. Default converter instance is returned if the sub-type is not found or not provided. When a default converter is not registered, ValueError exception is raised. :param sub_type: sub-type name :return: Converter instance
- register(converter: Converter, sub_type: Optional[str]) None
Register converter instance for given sub-type (granularity). If sub-type is not specified, converter is registered as the default one for the whole type. Default converter can be registered only once. :param converter: converter instance :param sub_type: sub-type name