001 002package com.commercetools.api.models.common; 003 004import java.time.*; 005import java.util.*; 006 007import com.fasterxml.jackson.annotation.JsonCreator; 008import com.fasterxml.jackson.annotation.JsonProperty; 009import com.fasterxml.jackson.databind.annotation.*; 010 011import io.vrap.rmf.base.client.ModelBase; 012import io.vrap.rmf.base.client.utils.Generated; 013 014import org.apache.commons.lang3.builder.EqualsBuilder; 015import org.apache.commons.lang3.builder.HashCodeBuilder; 016 017/** 018 * <p>A Reference represents a loose reference to another resource in the same Project identified by its <code>id</code>. The <code>typeId</code> indicates the type of the referenced resource. Each resource type has its corresponding Reference type, like ChannelReference. A referenced resource can be embedded through Reference Expansion. The expanded reference is the value of an additional <code>obj</code> field then.</p> 019 */ 020@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen") 021public class ReferenceImpl implements Reference, ModelBase { 022 023 private com.commercetools.api.models.common.ReferenceTypeId typeId; 024 025 private String id; 026 027 /** 028 * create instance with all properties 029 */ 030 @JsonCreator 031 ReferenceImpl(@JsonProperty("typeId") final com.commercetools.api.models.common.ReferenceTypeId typeId, 032 @JsonProperty("id") final String id) { 033 this.typeId = typeId; 034 this.id = id; 035 } 036 037 /** 038 * create empty instance 039 */ 040 public ReferenceImpl() { 041 } 042 043 /** 044 * <p>Type of referenced resource.</p> 045 */ 046 047 public com.commercetools.api.models.common.ReferenceTypeId getTypeId() { 048 return this.typeId; 049 } 050 051 /** 052 * <p>Unique ID of the referenced resource.</p> 053 */ 054 055 public String getId() { 056 return this.id; 057 } 058 059 public void setId(final String id) { 060 this.id = id; 061 } 062 063 @Override 064 public boolean equals(Object o) { 065 if (this == o) 066 return true; 067 068 if (o == null || getClass() != o.getClass()) 069 return false; 070 071 ReferenceImpl that = (ReferenceImpl) o; 072 073 return new EqualsBuilder().append(typeId, that.typeId).append(id, that.id).isEquals(); 074 } 075 076 @Override 077 public int hashCode() { 078 return new HashCodeBuilder(17, 37).append(typeId).append(id).toHashCode(); 079 } 080 081}