FileDocCategorySizeDatePackage
NetworkKey.javaAPI DocAndroid 5.1 API4042Thu Mar 12 22:22:10 GMT 2015android.net

NetworkKey

public class NetworkKey extends Object implements android.os.Parcelable
Information which identifies a specific network.
hide

Fields Summary
public static final int
TYPE_WIFI
A wifi network, for which {@link #wifiKey} will be populated.
public final int
type
The type of this network.
public final WifiKey
wifiKey
Information identifying a Wi-Fi network. Only set when {@link #type} equals {@link #TYPE_WIFI}.
public static final Parcelable.Creator
CREATOR
Constructors Summary
public NetworkKey(WifiKey wifiKey)
Construct a new {@link NetworkKey} for a Wi-Fi network.

param
wifiKey the {@link WifiKey} identifying this Wi-Fi network.


                           
       
        this.type = TYPE_WIFI;
        this.wifiKey = wifiKey;
    
private NetworkKey(android.os.Parcel in)

        type = in.readInt();
        switch (type) {
            case TYPE_WIFI:
                wifiKey = WifiKey.CREATOR.createFromParcel(in);
                break;
            default:
                throw new IllegalArgumentException("Parcel has unknown type: " + type);
        }
    
Methods Summary
public intdescribeContents()

        return 0;
    
public booleanequals(java.lang.Object o)

        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        NetworkKey that = (NetworkKey) o;

        return type == that.type && Objects.equals(wifiKey, that.wifiKey);
    
public inthashCode()

        return Objects.hash(type, wifiKey);
    
public java.lang.StringtoString()

        switch (type) {
            case TYPE_WIFI:
                return wifiKey.toString();
            default:
                // Don't throw an exception here in case someone is logging this object in a catch
                // block for debugging purposes.
                return "InvalidKey";
        }
    
public voidwriteToParcel(android.os.Parcel out, int flags)

        out.writeInt(type);
        switch (type) {
            case TYPE_WIFI:
                wifiKey.writeToParcel(out, flags);
                break;
            default:
                throw new IllegalStateException("NetworkKey has unknown type " + type);
        }