src/main/python/bktools/ext/python/objects.py
def swap(source: object, destination: object, attribute: str, nullable: bool = False) -> NoReturn:
    """
    Swap the value of a attribute between two objects.

    Parameters:
        source: The source object
        destination: The destination object
        attribute: The name of the desired attribute
        nullable: Flag indicating if the destination accept a NULL value
    """
    if source is None or destination is None or attribute is None:
        raise InvalidParameterException()

    attribute = attribute.strip()
    if len(attribute) <= 0:
        raise InvalidParameterException()

    if not hasattr(source, attribute) or not hasattr(destination, attribute):
        raise MissingAttributeException(attribute)

    if getattr(source, attribute) == getattr(destination, attribute):
        return

    value = getattr(source, attribute)
    if value is not None:
        setattr(destination, attribute, value)

    else:
        if nullable:
            setattr(destination, attribute, value)

        else:
            raise AttributeSwappingException(attribute)

    Swap the value of a attribute between two objects.

    Parameters:
        source: The source object
        destination: The destination object
        attribute: The name of the desired attribute
        nullable: Flag indicating if the destination accept a NULL value
    
Swap the value of a attribute between two objects.
Swap the value of a attribute between two objects .
def swap(source: object, destination: object, attribute: str, nullable: bool = False) -> NoReturn:
    if source is None or destination is None or attribute is None:
        raise InvalidParameterException()
    attribute = attribute.strip()
    if len(attribute) <= 0:
        raise InvalidParameterException()
    if not hasattr(source, attribute) or not hasattr(destination, attribute):
        raise MissingAttributeException(attribute)
    if getattr(source, attribute) == getattr(destination, attribute):
        return
    value = getattr(source, attribute)
    if value is not None:
        setattr(destination, attribute, value)
    else:
        if nullable:
            setattr(destination, attribute, value)
        else:
            raise AttributeSwappingException(attribute)
def swap ( source : object , destination : object , attribute : str , nullable : bool = False ) -> NoReturn : if source is None or destination is None or attribute is None : raise InvalidParameterException ( ) attribute = attribute . strip ( ) if len ( attribute ) <= 0 : raise InvalidParameterException ( ) if not hasattr ( source , attribute ) or not hasattr ( destination , attribute ) : raise MissingAttributeException ( attribute ) if getattr ( source , attribute ) == getattr ( destination , attribute ) : return value = getattr ( source , attribute ) if value is not None : setattr ( destination , attribute , value ) else : if nullable : setattr ( destination , attribute , value ) else : raise AttributeSwappingException ( attribute )
Swap the value of a attribute between two objects.
Swap the value of a attribute between two objects .
"""
    Swap the value of a attribute between two objects.

    Parameters:
        source: The source object
        destination: The destination object
        attribute: The name of the desired attribute
        nullable: Flag indicating if the destination accept a NULL value
    """
source
object
The source object
The source object
destination
object
The destination object
The destination object
attribute
str
The name of the desired attribute
The name of the desired attribute
nullable
bool
Flag indicating if the destination accept a NULL value
Flag indicating if the destination accept a NULL value