Source code for ooodev.adapter.lang.initialization_partial

from __future__ import annotations
from typing import Any, TYPE_CHECKING
import uno

from import XInitialization

from ooodev.exceptions import ex as mEx
from ooodev.loader import lo as mLo

    from ooodev.utils.type_var import UnoInterface

[docs]class InitializationPartial: """ Partial class for XInitialization. """
[docs] def __init__(self, component: XInitialization, interface: UnoInterface | None = XInitialization) -> None: """ Constructor Args: component (XInitialization): UNO Component that implements ```` interface. interface (UnoInterface, optional): The interface to be validated. Defaults to ``XInitialization``. """ def validate(comp: Any, obj_type: Any) -> None: if obj_type is None: return if not mLo.Lo.is_uno_interfaces(comp, obj_type): raise mEx.MissingInterfaceError(obj_type) validate(component, interface) self.__component = component
# region XInitialization
[docs] def initialize(self, *args: Any) -> None: """ Initializes the object. It should be called directly after the object is created. Raises: ``Exception`` """ self.__component.initialize(args)
# endregion XInitialization