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

com.azure.security.keyvault.certificates.implementation.CertificatePropertiesHelper Maven / Gradle / Ivy

There is a newer version: 4.6.7
Show newest version
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
package com.azure.security.keyvault.certificates.implementation;

import com.azure.security.keyvault.certificates.implementation.models.CertificateItem;
import com.azure.security.keyvault.certificates.models.CertificateProperties;
import com.azure.security.keyvault.certificates.models.DeletedCertificate;

public final class CertificatePropertiesHelper {
    private static CertificatePropertiesAccessor accessor;

    public interface CertificatePropertiesAccessor {
        CertificateProperties createCertificateProperties(CertificateItem item);
    }

    public static CertificateProperties createCertificateProperties(CertificateItem item) {
        if (accessor == null) {
            // CertificateProperties doesn't have a public constructor but DeletedCertificate does and creates an
            // instance of CertificateProperties. This will result in CertificateProperties being loaded by the class
            // loader.
            new DeletedCertificate();
        }

        assert accessor != null;
        return accessor.createCertificateProperties(item);
    }

    public static void setAccessor(CertificatePropertiesAccessor accessor) {
        CertificatePropertiesHelper.accessor = accessor;
    }

    private CertificatePropertiesHelper() { }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy