/* * (non-Javadoc) * * @see java.lang.Object#equals(java.lang.Object) */ @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; ExchangeRate other = (ExchangeRate) obj; if (base == null) { if (other.base != null) return false; } else if (!base.equals(other.base)) return false; if (chain[0] != this) { if (!Arrays.equals(chain, other.chain)) return false; } if (exchangeRateType == null) { if (other.exchangeRateType != null) return false; } else if (!exchangeRateType.equals(other.exchangeRateType)) return false; if (factor == null) { if (other.factor != null) return false; } else if (!factor.equals(other.factor)) return false; if (provider == null) { if (other.provider != null) return false; } else if (!provider.equals(other.provider)) return false; if (term == null) { if (other.term != null) return false; } else if (!term.equals(other.term)) return false; if (validFrom == null) { if (other.validFrom != null) return false; } else if (!validFrom.equals(other.validFrom)) return false; if (validUntil == null) { if (other.validUntil != null) return false; } else if (!validUntil.equals(other.validUntil)) return false; return true; }
/* * (non-Javadoc) * * @see java.lang.Object#hashCode() */ @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((base == null) ? 0 : base.hashCode()); result = prime * result + ((exchangeRateType == null) ? 0 : exchangeRateType.hashCode()); result = prime * result + ((factor == null) ? 0 : factor.hashCode()); result = prime * result + ((provider == null) ? 0 : provider.hashCode()); result = prime * result + ((term == null) ? 0 : term.hashCode()); result = prime * result + ((validFrom == null) ? 0 : validFrom.hashCode()); result = prime * result + ((validUntil == null) ? 0 : validUntil.hashCode()); if (chain[0] != this) { result = prime * result + Arrays.hashCode(chain); } return result; }
/* * (non-Javadoc) * * @see java.lang.Object#toString() */ @Override public String toString() { return "ExchangeRate [type=" + exchangeRateType.getId() + ", base=" + base + ", term=" + term + ", factor=" + factor + ", validFrom=" + validFrom + ", validUntil=" + validUntil + ", provider=" + provider + "]"; }
/** * Sets the {@link ExchangeRateType} * * @param exchangeRateType to be applied * @return the builder instance */ public Builder setExchangeRateType(String exchangeRateType) { this.exchangeRateType = ExchangeRateType.of(exchangeRateType); return this; }