001
002package com.commercetools.history.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 * Money
019 */
020@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
021public class MoneyImpl implements Money, ModelBase {
022
023    private String currencyCode;
024
025    private Integer centAmount;
026
027    private Integer fractionDigits;
028
029    private com.commercetools.history.models.common.MoneyType type;
030
031    /**
032     * create instance with all properties
033     */
034    @JsonCreator
035    MoneyImpl(@JsonProperty("currencyCode") final String currencyCode,
036            @JsonProperty("centAmount") final Integer centAmount,
037            @JsonProperty("fractionDigits") final Integer fractionDigits,
038            @JsonProperty("type") final com.commercetools.history.models.common.MoneyType type) {
039        this.currencyCode = currencyCode;
040        this.centAmount = centAmount;
041        this.fractionDigits = fractionDigits;
042        this.type = type;
043    }
044
045    /**
046     * create empty instance
047     */
048    public MoneyImpl() {
049    }
050
051    /**
052     *  <p>Currency code compliant to ISO 4217.</p>
053     */
054
055    public String getCurrencyCode() {
056        return this.currencyCode;
057    }
058
059    /**
060     *
061     */
062
063    public Integer getCentAmount() {
064        return this.centAmount;
065    }
066
067    /**
068     *
069     */
070
071    public Integer getFractionDigits() {
072        return this.fractionDigits;
073    }
074
075    /**
076     *
077     */
078
079    public com.commercetools.history.models.common.MoneyType getType() {
080        return this.type;
081    }
082
083    public void setCurrencyCode(final String currencyCode) {
084        this.currencyCode = currencyCode;
085    }
086
087    public void setCentAmount(final Integer centAmount) {
088        this.centAmount = centAmount;
089    }
090
091    public void setFractionDigits(final Integer fractionDigits) {
092        this.fractionDigits = fractionDigits;
093    }
094
095    public void setType(final com.commercetools.history.models.common.MoneyType type) {
096        this.type = type;
097    }
098
099    @Override
100    public boolean equals(Object o) {
101        if (this == o)
102            return true;
103
104        if (o == null || getClass() != o.getClass())
105            return false;
106
107        MoneyImpl that = (MoneyImpl) o;
108
109        return new EqualsBuilder().append(currencyCode, that.currencyCode)
110                .append(centAmount, that.centAmount)
111                .append(fractionDigits, that.fractionDigits)
112                .append(type, that.type)
113                .append(currencyCode, that.currencyCode)
114                .append(centAmount, that.centAmount)
115                .append(fractionDigits, that.fractionDigits)
116                .append(type, that.type)
117                .isEquals();
118    }
119
120    @Override
121    public int hashCode() {
122        return new HashCodeBuilder(17, 37).append(currencyCode)
123                .append(centAmount)
124                .append(fractionDigits)
125                .append(type)
126                .toHashCode();
127    }
128
129}