Android Open Source - dropbox-android-core-sdk-mirror Token Pair






From Project

Back to project page dropbox-android-core-sdk-mirror.

License

The source code is released under:

Copyright (c) 2009-2011 Dropbox Inc., http://www.dropbox.com/ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "So...

If you think the Android project dropbox-android-core-sdk-mirror listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.dropbox.client2.session;
/*w  w w.  j a v  a  2s  . c  o  m*/
import java.io.Serializable;

/**
 * <p>
 * Just two strings -- a "key" and a "secret". Used by OAuth in several
 * places (consumer key/secret, request token/secret, access token/secret).
 * Use specific subclasses instead of using this class directly.
 * </p>
 */
public abstract class TokenPair implements Serializable {

    private static final long serialVersionUID = -42727403799660313L;

    /**
     * The "key" portion of the pair.  For example, the "consumer key",
     * "request token", or "access token".  Will never contain the "|"
     * character.
     */
    public final String key;

    /**
     * The "secret" portion of the pair.  For example, the "consumer secret",
     * "request token secret", or "access token secret".
     */
    public final String secret;

    /**
     * @param key assigned to {@link #key}.
     * @param secret assigned to {@link #secret}.
     *
     * @throws IllegalArgumentException if key or secret is null or invalid.
     */
    public TokenPair(String key, String secret) {
        if (key == null)
            throw new IllegalArgumentException("'key' must be non-null");
        if (key.contains("|"))
            throw new IllegalArgumentException("'key' must not contain a \"|\" character: \"" + key + "\"");
        if (secret == null)
            throw new IllegalArgumentException("'secret' must be non-null");

        this.key = key;
        this.secret = secret;
    }

    @Override
    public int hashCode() {
        return key.hashCode() ^ (secret.hashCode() << 1);
    }

    @Override
    public boolean equals(Object o) {
        return o instanceof TokenPair && equals((TokenPair) o);
    }

    public boolean equals(TokenPair o) {
        return key.equals(o.key) && secret.equals(o.secret);
    }

    @Override
    public String toString() {
        return "{key=\"" + key + "\", secret=\"" + secret.charAt(0) + "...\"}";
    }
}




Java Source Code List

.CopyBetweenAccounts.java
.SearchCache.java
com.dropbox.android.sample.DBRoulette.java
com.dropbox.android.sample.DownloadRandomPicture.java
com.dropbox.android.sample.UploadPicture.java
com.dropbox.client2.DropboxAPI.java
com.dropbox.client2.ProgressListener.java
com.dropbox.client2.RESTUtility.java
com.dropbox.client2.SdkVersion.java
com.dropbox.client2.android.AndroidAuthSession.java
com.dropbox.client2.android.AuthActivity.java
com.dropbox.client2.exception.DropboxException.java
com.dropbox.client2.exception.DropboxFileSizeException.java
com.dropbox.client2.exception.DropboxIOException.java
com.dropbox.client2.exception.DropboxLocalStorageFullException.java
com.dropbox.client2.exception.DropboxParseException.java
com.dropbox.client2.exception.DropboxPartialFileException.java
com.dropbox.client2.exception.DropboxSSLException.java
com.dropbox.client2.exception.DropboxServerException.java
com.dropbox.client2.exception.DropboxUnlinkedException.java
com.dropbox.client2.jsonextract.JsonBase.java
com.dropbox.client2.jsonextract.JsonExtractionException.java
com.dropbox.client2.jsonextract.JsonExtractor.java
com.dropbox.client2.jsonextract.JsonList.java
com.dropbox.client2.jsonextract.JsonMap.java
com.dropbox.client2.jsonextract.JsonThing.java
com.dropbox.client2.session.AbstractSession.java
com.dropbox.client2.session.AccessTokenPair.java
com.dropbox.client2.session.AppKeyPair.java
com.dropbox.client2.session.RequestTokenPair.java
com.dropbox.client2.session.Session.java
com.dropbox.client2.session.TokenPair.java
com.dropbox.client2.session.WebAuthSession.java