Class PriceCompositeId


  • public final class PriceCompositeId
    extends java.lang.Object
    This class is only meant for the internal use of the commercetools-sync-java library.

    Since there is no one unique identifier for prices on the commercetools API, we uniquely identify a price as a composite id of the following fields: countryCode, currencyCode, channelId, customerGroupId, validFrom and validUntil. This class models such composite key.

    • Method Detail

      • of

        @Nonnull
        public static PriceCompositeId of​(@Nonnull
                                          io.sphere.sdk.products.PriceDraft priceDraft)
        Given a PriceDraft, creates a PriceCompositeId using the following fields from the supplied PriceDraft:
        1. currencyCode: CurrencyCode of PriceDraft.getValue()
        2. countryCode: PriceDraft.getCountry()
        3. channelId: id of PriceDraft.getChannel()
        4. customerGroupId: id of PriceDraft.getCustomerGroup()
        5. validFrom: PriceDraft.getValidFrom()
        6. validUntil: PriceDraft.getValidUntil()
        Parameters:
        priceDraft - a composite id is built using its fields.
        Returns:
        a composite id comprised of the fields of the supplied PriceDraft.
      • of

        @Nonnull
        public static PriceCompositeId of​(@Nonnull
                                          io.sphere.sdk.products.Price price)
        Given a Price, creates a PriceCompositeId using the following fields from the supplied Price:
        1. currencyCode: CurrencyCode of Price.getValue()
        2. countryCode: Price.getCountry()
        3. channelId: id of Price.getChannel()
        4. customerGroupId: id of Price.getCustomerGroup()
        5. validFrom: Price.getValidFrom()
        6. validUntil: Price.getValidUntil()
        Parameters:
        price - a composite id is built using its fields.
        Returns:
        a composite id comprised of the fields of the supplied Price.
      • getCountryCode

        public com.neovisionaries.i18n.CountryCode getCountryCode()
      • getCurrencyCode

        public java.lang.String getCurrencyCode()
      • getChannelId

        public java.lang.String getChannelId()
      • getCustomerGroupId

        public java.lang.String getCustomerGroupId()
      • getValidFrom

        public java.time.ZonedDateTime getValidFrom()
      • getValidUntil

        public java.time.ZonedDateTime getValidUntil()
      • equals

        public boolean equals​(java.lang.Object otherObject)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object