Source code for ooodev.adapter.reflection.type_description_partial

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

from import XTypeDescription
from import TypeClass

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

    from ooodev.utils.type_var import UnoInterface

[docs]class TypeDescriptionPartial: """ Partial class for XTypeDescription. """
[docs] def __init__( self, component: XTypeDescription, interface: UnoInterface | None = XTypeDescription, ) -> None: """ Constructor Args: component (XTypeDescription): UNO Component that implements ```` interface. interface (UnoInterface, optional): The interface to be validated. Defaults to ``XTypeDescription``. """ 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 XTypeDescription
[docs] def get_name(self) -> str: """ Returns the fully qualified name of the UNOIDL entity. """ return self.__component.getName()
[docs] def get_type_class(self) -> TypeClass: """ Returns the type class of the reflected UNOIDL entity. Returns: TypeClass: The type class of the reflected UNOIDL entity. Hint: - ``TypeClass`` is an enum and can be imported from ````. """ return self.__component.getTypeClass() # type: ignore
# endregion XTypeDescription