def METHOD_NAME(self, attr: Attr, reference: int, replace: str):
    """Search and replace the old qualified attribute type name with the
    new one in the attr types, choices and default value."""
    for attr_type in attr.types:
        if attr_type.reference == reference:
            attr_type.qname = replace
            if isinstance(attr.default, str) and attr.default.startswith("@enum@"):
                members = text.suffix(attr.default, "::")
                attr.default = f"@enum@{replace}::{members}"
    for choice in attr.choices:
        self.METHOD_NAME(choice, reference, replace)