// Path: kraken_lib/src/main/java/com/github/marcosalis/kraken/utils/HashUtils.java
// public final class HashUtils {
// 
//     private static final HashFunction DEFAULT_HASH = Hashing.murmur3_128();
// 
//     private HashUtils() {
//         // hidden constructor, no instantiation needed
//     }
// 
//     /**
//      * Gets a String hash generated using the default hashing algorithm with the passed strings as
//      * input.
//      */
//     @NonNull
//     public static String getDefaultHash(@NonNull String... strings) {
//         return getHash(DEFAULT_HASH, strings);
//     }
// 
//     /**
//      * Gets a String hash generated using the MD5 hashing algorithm with the passed strings as
//      * input.
//      */
//     @NonNull
//     public static String getMD5Hash(@NonNull String... strings) {
//         return getHash(Hashing.md5(), strings);
//     }
// 
//     /**
//      * Gets a String hash generated using the passed hashing algorithm.
//      */
//     @NonNull
//     public static String getHash(@NonNull HashFunction hash, @NonNull String... strings) {
//         final Hasher hasher = hash.newHasher();
//         for (String input : strings) {
//             hasher.putString(input);
//         }
//         return hasher.hash().toString();
//     }
// 
//     /**
//      * Interface that represent any suitable object that can be used as a String cache key. The key
//      * itself retrieved by calling the hash() method.
//      *
//      * TODO: move this
//      */
//     public interface CacheKey {
// 
//         public String hash();
//     }
// 
// }


import android.os.Parcel;
import android.os.Parcelable;
import android.support.annotation.NonNull;
import com.github.marcosalis.kraken.utils.HashUtils;
import com.google.common.annotations.Beta;
import com.google.common.hash.HashFunction;
import com.google.common.hash.Hashing;
import java.net.URI;
import javax.annotation.concurrent.Immutable;

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(mUri.toString());
    }

    /**
     * Gets the generated key for this object
     */
    @Override
    public String hash() {
        return mKey;
    }

    /**
     * Gets the full URL for GET requests
     */
    @Override
    public String getUrl() {
        return mUri.toString();
    }

    /**
     * Generate an unique identifier for the cache key from the path part of the given URI.
     */
    private String hashUri() throws IllegalArgumentException {
        String path = mUri.getPath();
        if (path == null || path.length() < MIN_KEY_SOURCE) {
            throw new IllegalArgumentException("Unsuitable URI");
        }
// Path: kraken_lib/src/main/java/com/github/marcosalis/kraken/utils/HashUtils.java
// public final class HashUtils {
// 
//     private static final HashFunction DEFAULT_HASH = Hashing.murmur3_128();
// 
//     private HashUtils() {
//         // hidden constructor, no instantiation needed
//     }
// 
//     /**
//      * Gets a String hash generated using the default hashing algorithm with the passed strings as
//      * input.
//      */
//     @NonNull
//     public static String getDefaultHash(@NonNull String... strings) {
//         return getHash(DEFAULT_HASH, strings);
//     }
// 
//     /**
//      * Gets a String hash generated using the MD5 hashing algorithm with the passed strings as
//      * input.
//      */
//     @NonNull
//     public static String getMD5Hash(@NonNull String... strings) {
//         return getHash(Hashing.md5(), strings);
//     }
// 
//     /**
//      * Gets a String hash generated using the passed hashing algorithm.
//      */
//     @NonNull
//     public static String getHash(@NonNull HashFunction hash, @NonNull String... strings) {
//         final Hasher hasher = hash.newHasher();
//         for (String input : strings) {
//             hasher.putString(input);
//         }
//         return hasher.hash().toString();
//     }
// 
//     /**
//      * Interface that represent any suitable object that can be used as a String cache key. The key
//      * itself retrieved by calling the hash() method.
//      *
//      * TODO: move this
//      */
//     public interface CacheKey {
// 
//         public String hash();
//     }
// 
// }


// Path: kraken_lib/src/main/java/com/github/marcosalis/kraken/cache/keys/URICacheUrlKey.java
import android.os.Parcel;
import android.os.Parcelable;
import android.support.annotation.NonNull;
import com.github.marcosalis.kraken.utils.HashUtils;
import com.google.common.annotations.Beta;
import com.google.common.hash.HashFunction;
import com.google.common.hash.Hashing;
import java.net.URI;
import javax.annotation.concurrent.Immutable;


    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(mUri.toString());
    }

    /**
     * Gets the generated key for this object
     */
    @Override
    public String hash() {
        return mKey;
    }

    /**
     * Gets the full URL for GET requests
     */
    @Override
    public String getUrl() {
        return mUri.toString();
    }

    /**
     * Generate an unique identifier for the cache key from the path part of the given URI.
     */
    private String hashUri() throws IllegalArgumentException {
        String path = mUri.getPath();
        if (path == null || path.length() < MIN_KEY_SOURCE) {
            throw new IllegalArgumentException("Unsuitable URI");
        }
        return HashUtils.getHash(HASH_FUNCTION, path);