/** *Copyright [2009-2010] [dennis zhuang(killme2008@gmail.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 net.rubyeye.xmemcached; /** * Response for gets command.It's a value object. * * @author dennis * */ public final class GetsResponse<T> { private final long cas; private final T value; public GetsResponse(final long cas,final T value) { super(); this.cas = cas; this.value = value; } public long getCas() { return this.cas; } public T getValue() { return this.value; } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + (int) (this.cas ^ (this.cas >>> 32)); result = prime * result + ((this.value == null) ? 0 : this.value.hashCode()); return result; } @Override @SuppressWarnings("unchecked") public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } GetsResponse other = (GetsResponse) obj; if (this.cas != other.cas) { return false; } if (this.value == null) { if (other.value != null) { return false; } } else if (!this.value.equals(other.value)) { return false; } return true; } @Override public String toString() { return "GetsResponse[cas=" + this.cas + ",value=" + this.value + "]"; } }