Source code for ooodev.adapter.container.set_partial

from __future__ import annotations
from typing import Any, TYPE_CHECKING

from import XSet
from ooodev.adapter.container.enumeration_access_partial import EnumerationAccessPartial

    from ooodev.utils.builder.default_builder import DefaultBuilder
    from ooodev.utils.type_var import UnoInterface

[docs]class SetPartial(EnumerationAccessPartial): """ Partial Class for XSet. """ # pylint: disable=unused-argument
[docs] def __init__(self, component: XSet, interface: UnoInterface | None = XSet) -> None: """ Constructor Args: component (XSet): UNO Component that implements ````. interface (UnoInterface, optional): The interface to be validated. Defaults to ``XSet``. """ EnumerationAccessPartial.__init__(self, component, interface) self.__component = component
# region XSet
[docs] def has(self, element: Any) -> bool: """ Gets if element is in this container. """ return self.__component.has(element)
[docs] def insert(self, element: Any) -> None: """ Inserts the given element into this container. Raises: ``IllegalArgumentException`` ``ElementExistException`` """ self.__component.insert(element)
[docs] def remove(self, element: Any) -> None: """ removes the given element from this container. Raises: ``IllegalArgumentException`` ``NoSuchElementException`` """ self.__component.remove(element)
# endregion XSet
[docs]def get_builder(component: Any) -> DefaultBuilder: """ Get the builder for the component. Args: component (Any): The component. Returns: DefaultBuilder: Builder instance. """ # pylint: disable=import-outside-toplevel # pylint: disable=redefined-outer-name from ooodev.utils.builder.default_builder import DefaultBuilder builder = DefaultBuilder(component) builder.auto_add_interface("") builder.set_omit( "", "", ) return builder