1 /*
2 * Copyright (C) 2010 eXo Platform SAS.
3 *
4 * This is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License as
6 * published by the Free Software Foundation; either version 2.1 of
7 * the License, or (at your option) any later version.
8 *
9 * This software is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this software; if not, write to the Free
16 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
17 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
18 */
19
20 package org.exoplatform.services.portletcache;
21
22 import java.io.Serializable;
23 import java.util.Arrays;
24 import java.util.Objects;
25
26 /**
27 * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
28 * @version $Revision$
29 */
30 class MarkupFragment implements Serializable
31 {
32
33 private static final long serialVersionUID = -7496999592382053294L;
34
35 /** . */
36 final long expirationTimeMillis;
37
38 /** . */
39 final byte[] data;
40
41 MarkupFragment(long expirationTimeMillis, byte[] data)
42 {
43 this.expirationTimeMillis = expirationTimeMillis;
44 this.data = data;
45 }
46
47 @Override
48 public boolean equals(Object o) {
49 if (this == o) return true;
50 if (o == null || getClass() != o.getClass()) return false;
51 MarkupFragment that = (MarkupFragment) o;
52 return expirationTimeMillis == that.expirationTimeMillis &&
53 Arrays.equals(data, that.data);
54 }
55
56 @Override
57 public int hashCode() {
58 return Objects.hash(expirationTimeMillis, data);
59 }
60 }