Java tutorial
/* Copyright 2010 platers.code 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.pc.dailymile.domain; import java.io.Serializable; import org.apache.commons.lang.builder.EqualsBuilder; import org.apache.commons.lang.builder.HashCodeBuilder; import org.apache.commons.lang.builder.ToStringBuilder; /* * {"type":"image", "height":75, * "width":75, "url":\"http://....jpg" * } */ public class MediaInfo implements Serializable { private String type; private String height; private String width; private String url; public String getType() { return type; } public void setType(String type) { this.type = type; } public String getHeight() { return height; } public void setHeight(String height) { this.height = height; } public String getWidth() { return width; } public void setWidth(String width) { this.width = width; } public String getUrl() { return url; } public void setUrl(String url) { this.url = url; } @Override public String toString() { return new ToStringBuilder(this).append("type", type).append("height", height).append("width", width) .append("url", url).toString(); } @Override public int hashCode() { return new HashCodeBuilder(17, 37).append(type).append(height).append(width).append(url).toHashCode(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; MediaInfo other = (MediaInfo) obj; return new EqualsBuilder().append(type, other.type).append(height, other.height).append(url, other.url) .append(width, other.width).isEquals(); } }