Java tutorial
/** * Copyright 2011 Shopzilla.com * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.shopzilla.api.client.model; import org.apache.commons.lang.builder.EqualsBuilder; import org.apache.commons.lang.builder.HashCodeBuilder; import org.apache.commons.lang.builder.ToStringBuilder; import org.apache.commons.lang.builder.ToStringStyle; /** * @author sscanlon * */ public class Offer { private Long id; private Long mid; private Price price; private Long categoryId; private String title; private String description; private String URL; private String detailURL; private Merchant merchant; @Override public String toString() { return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE).append("id", id).append("mid", mid) .append("price", price).append("categoryId", categoryId).append("title", title) .append("description", description).append("URL", URL).append("detailURL", detailURL).toString(); } @Override public boolean equals(Object o) { if (o == this) { return true; } if (o == null || !(o instanceof Offer)) { return false; } Offer rhs = (Offer) o; return new EqualsBuilder().append(id, rhs.id).isEquals(); } @Override public int hashCode() { return new HashCodeBuilder().append(id).toHashCode(); } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public Long getMid() { return mid; } public void setMid(Long mid) { this.mid = mid; } public Price getPrice() { return price; } public void setPrice(Price price) { this.price = price; } public Long getCategoryId() { return categoryId; } public void setCategoryId(Long categoryId) { this.categoryId = categoryId; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public String getURL() { return URL; } public void setURL(String uRL) { URL = uRL; } public String getDetailURL() { return detailURL; } public void setDetailURL(String detailURL) { this.detailURL = detailURL; } public Merchant getMerchant() { return merchant; } public void setMerchant(Merchant merchant) { this.merchant = merchant; } }