/**
  * Restricted copy constructor.
  *
  * @param beanToCopy the bean to copy from, not null
  */
 private Builder(ImmutableTermDepositConvention beanToCopy) {
   this.currency = beanToCopy.getCurrency();
   this.name = beanToCopy.name;
   this.businessDayAdjustment = beanToCopy.getBusinessDayAdjustment();
   this.dayCount = beanToCopy.getDayCount();
   this.spotDateOffset = beanToCopy.getSpotDateOffset();
 }
 @Override
 public boolean equals(Object obj) {
   if (obj == this) {
     return true;
   }
   if (obj != null && obj.getClass() == this.getClass()) {
     ImmutableTermDepositConvention other = (ImmutableTermDepositConvention) obj;
     return JodaBeanUtils.equal(getCurrency(), other.getCurrency())
         && JodaBeanUtils.equal(name, other.name)
         && JodaBeanUtils.equal(getBusinessDayAdjustment(), other.getBusinessDayAdjustment())
         && JodaBeanUtils.equal(getDayCount(), other.getDayCount())
         && JodaBeanUtils.equal(getSpotDateOffset(), other.getSpotDateOffset());
   }
   return false;
 }
  /**
   * Obtains a convention based on the specified currency, business day adjustment, day count
   * convention and spot date offset.
   *
   * @param currency the currency, in which the payments are made
   * @param businessDayAdjustment the business day adjustment to apply to the start and end date
   * @param dayCount the day count convention, used to convert dates to a numerical value
   * @param spotDateOffset the offset of the spot value date from the trade date
   * @return the convention
   */
  public static ImmutableTermDepositConvention of(
      Currency currency,
      BusinessDayAdjustment businessDayAdjustment,
      DayCount dayCount,
      DaysAdjustment spotDateOffset) {

    return ImmutableTermDepositConvention.builder()
        .currency(currency)
        .businessDayAdjustment(businessDayAdjustment)
        .dayCount(dayCount)
        .spotDateOffset(spotDateOffset)
        .build();
  }