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

com.arm.mbed.cloud.sdk.security.adapters.VerificationResponseAdapter Maven / Gradle / Ivy

Go to download

The Pelion Cloud SDK (formerly known as Mbed Cloud SDK) provides a simplified interface to the Pelion Cloud APIs by exposing functionality using conventions and paradigms familiar to Java developers.

There is a newer version: 2.5.0
Show newest version
package com.arm.mbed.cloud.sdk.security.adapters;

import com.arm.mbed.cloud.sdk.annotations.Internal;
import com.arm.mbed.cloud.sdk.annotations.Preamble;
import com.arm.mbed.cloud.sdk.common.GenericAdapter.Mapper;
import com.arm.mbed.cloud.sdk.common.TranslationUtils;
import com.arm.mbed.cloud.sdk.internal.externalca.model.CertificateIssuerVerifyResponse;
import com.arm.mbed.cloud.sdk.security.model.VerificationResponse;

@Preamble(description = "Adapter for verification response model")
@Internal
public final class VerificationResponseAdapter {

    private VerificationResponseAdapter() {
        super();
    }

    /**
     * Maps verification response.
     * 
     * @param response
     *            response to map.
     * @return response.
     */
    public static VerificationResponse map(CertificateIssuerVerifyResponse response) {
        if (response == null) {
            return null;
        }
        return new VerificationResponse(TranslationUtils.toBool(response.isSuccessful(), false), response.getMessage());
    }

    /**
     * Gets a mapper.
     * 
     * @return a mapper.
     */
    public static Mapper getMapper() {
        return new Mapper() {

            @Override
            public VerificationResponse map(CertificateIssuerVerifyResponse toBeMapped) {
                return VerificationResponseAdapter.map(toBeMapped);
            }

        };
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy