All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.azure.communication.callautomation.implementation.converters.PhoneNumberIdentifierConverter Maven / Gradle / Ivy

Go to download

This package contains clients and data structures used to make call with Azure Communication Call Automation Service. For this release, see notes - https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/communication/azure-communication-callautomation/README.md and https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/communication/azure-communication-callautomation/CHANGELOG.md.

The newest version!
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

package com.azure.communication.callautomation.implementation.converters;

import com.azure.communication.callautomation.implementation.models.PhoneNumberIdentifierModel;
import com.azure.communication.common.PhoneNumberIdentifier;

/**
 * A converter for {@link PhoneNumberIdentifier} and {@link PhoneNumberIdentifierModel}
 */
public final class PhoneNumberIdentifierConverter {

    /**
     * Converts to {@link PhoneNumberIdentifierModel}.
     */
    public static PhoneNumberIdentifierModel convert(PhoneNumberIdentifier phoneNumberIdentifier) {

        PhoneNumberIdentifierModel phoneNumberIdentifierModel
            = (phoneNumberIdentifier == null || phoneNumberIdentifier.getPhoneNumber().isEmpty())
                ? null
                : CommunicationIdentifierConverter
                    .convert(new PhoneNumberIdentifier(phoneNumberIdentifier.getPhoneNumber()))
                    .getPhoneNumber();
        return phoneNumberIdentifierModel;
    }

    /**
     * Converts to {@link PhoneNumberIdentifier}.
     */
    public static PhoneNumberIdentifier convert(PhoneNumberIdentifierModel phoneNumberIdentifierModel) {

        PhoneNumberIdentifier phoneNumberIdentifier
            = (phoneNumberIdentifierModel == null || phoneNumberIdentifierModel.getValue().isEmpty())
                ? null
                : new PhoneNumberIdentifier(phoneNumberIdentifierModel.getValue());

        return phoneNumberIdentifier;
    }

    private PhoneNumberIdentifierConverter() {
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy