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

io.sphere.sdk.discountcodes.DiscountCodeInfo Maven / Gradle / Ivy

There is a newer version: 2.16.0
Show newest version
package io.sphere.sdk.discountcodes;

import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import io.sphere.sdk.models.Reference;
import io.sphere.sdk.models.Referenceable;

import java.util.Optional;

@JsonDeserialize(as = DiscountCodeInfoImpl.class)
public interface DiscountCodeInfo {
    Reference getDiscountCode();

    DiscountCodeState getState();

    static DiscountCodeInfo of(final Referenceable discountCode, final DiscountCodeState state) {
        final Reference discountCodeReference =
                Optional.ofNullable(discountCode).map(d -> d.toReference()).orElse(null);
        return new DiscountCodeInfoImpl(discountCodeReference, state);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy