001 002package com.commercetools.api.models.product_discount; 003 004import java.time.*; 005import java.util.*; 006 007import com.commercetools.api.models.common.ReferenceTypeId; 008import com.fasterxml.jackson.annotation.JsonCreator; 009import com.fasterxml.jackson.annotation.JsonProperty; 010import com.fasterxml.jackson.databind.annotation.*; 011 012import io.vrap.rmf.base.client.ModelBase; 013import io.vrap.rmf.base.client.utils.Generated; 014 015import org.apache.commons.lang3.builder.EqualsBuilder; 016import org.apache.commons.lang3.builder.HashCodeBuilder; 017 018/** 019 * <p>ResourceIdentifier to a ProductDiscount.</p> 020 */ 021@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen") 022public class ProductDiscountResourceIdentifierImpl implements ProductDiscountResourceIdentifier, ModelBase { 023 024 private com.commercetools.api.models.common.ReferenceTypeId typeId; 025 026 private String id; 027 028 private String key; 029 030 /** 031 * create instance with all properties 032 */ 033 @JsonCreator 034 ProductDiscountResourceIdentifierImpl(@JsonProperty("id") final String id, @JsonProperty("key") final String key) { 035 this.id = id; 036 this.key = key; 037 this.typeId = ReferenceTypeId.findEnum("product-discount"); 038 } 039 040 /** 041 * create empty instance 042 */ 043 public ProductDiscountResourceIdentifierImpl() { 044 this.typeId = ReferenceTypeId.findEnum("product-discount"); 045 } 046 047 /** 048 * <p>Type of referenced resource. If given, it must match the expected ReferenceTypeId of the referenced resource.</p> 049 */ 050 051 public com.commercetools.api.models.common.ReferenceTypeId getTypeId() { 052 return this.typeId; 053 } 054 055 /** 056 * <p>Unique identifier of the referenced ProductDiscount. Either <code>id</code> or <code>key</code> is required.</p> 057 */ 058 059 public String getId() { 060 return this.id; 061 } 062 063 /** 064 * <p>User-defined unique identifier of the referenced ProductDiscount. Either <code>id</code> or <code>key</code> is required.</p> 065 */ 066 067 public String getKey() { 068 return this.key; 069 } 070 071 public void setId(final String id) { 072 this.id = id; 073 } 074 075 public void setKey(final String key) { 076 this.key = key; 077 } 078 079 @Override 080 public boolean equals(Object o) { 081 if (this == o) 082 return true; 083 084 if (o == null || getClass() != o.getClass()) 085 return false; 086 087 ProductDiscountResourceIdentifierImpl that = (ProductDiscountResourceIdentifierImpl) o; 088 089 return new EqualsBuilder().append(typeId, that.typeId) 090 .append(id, that.id) 091 .append(key, that.key) 092 .append(typeId, that.typeId) 093 .append(id, that.id) 094 .append(key, that.key) 095 .isEquals(); 096 } 097 098 @Override 099 public int hashCode() { 100 return new HashCodeBuilder(17, 37).append(typeId).append(id).append(key).toHashCode(); 101 } 102 103}