MarkupFragment.java

  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. package org.exoplatform.services.portletcache;

  20. import java.io.Serializable;
  21. import java.util.Arrays;
  22. import java.util.Objects;

  23. /**
  24.  * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
  25.  * @version $Revision$
  26.  */
  27. class MarkupFragment implements Serializable
  28. {

  29.   private static final long serialVersionUID = -7496999592382053294L;

  30.   /** . */
  31.   final long expirationTimeMillis;

  32.   /** . */
  33.   final byte[] data;

  34.   MarkupFragment(long expirationTimeMillis, byte[] data)
  35.   {
  36.     this.expirationTimeMillis = expirationTimeMillis;
  37.     this.data = data;
  38.   }

  39.   @Override
  40.   public boolean equals(Object o) {
  41.     if (this == o) return true;
  42.     if (o == null || getClass() != o.getClass()) return false;
  43.     MarkupFragment that = (MarkupFragment) o;
  44.     return expirationTimeMillis == that.expirationTimeMillis &&
  45.             Arrays.equals(data, that.data);
  46.   }

  47.   @Override
  48.   public int hashCode() {
  49.     return Objects.hash(expirationTimeMillis, data);
  50.   }
  51. }