001/* 002 * Copyright 2010-2013 Ning, Inc. 003 * 004 * Ning licenses this file to you under the Apache License, version 2.0 005 * (the "License"); you may not use this file except in compliance with the 006 * License. You may obtain a copy of the License at: 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 012 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 013 * License for the specific language governing permissions and limitations 014 * under the License. 015 */ 016 017package com.ning.billing.recurly.model; 018 019import javax.xml.bind.annotation.XmlElement; 020 021/** 022 * Subscription object for update calls. 023 * <p/> 024 * The timeframe parameter is specific to the update. 025 */ 026public class SubscriptionUpdate extends AbstractSubscription { 027 028 public static enum Timeframe { 029 now, 030 renewal 031 } 032 033 @XmlElement 034 private Timeframe timeframe; 035 036 public Timeframe getTimeframe() { 037 return timeframe; 038 } 039 040 public void setTimeframe(final Timeframe timeframe) { 041 this.timeframe = timeframe; 042 } 043 044 @Override 045 public boolean equals(final Object o) { 046 if (this == o) { 047 return true; 048 } 049 if (!(o instanceof SubscriptionUpdate)) { 050 return false; 051 } 052 if (!super.equals(o)) { 053 return false; 054 } 055 056 final SubscriptionUpdate that = (SubscriptionUpdate) o; 057 058 if (timeframe != that.timeframe) { 059 return false; 060 } 061 062 return true; 063 } 064 065 @Override 066 public int hashCode() { 067 int result = super.hashCode(); 068 result = 31 * result + (timeframe != null ? timeframe.hashCode() : 0); 069 return result; 070 } 071}