public class SerialNumber
extends java.lang.Object
implements java.io.Serializable
SerialNumber
represent serial numbers of devices on the USB bus.
'Fake' serial numbers are serial numbers that will *never* appear for a real device; they
are useful, for example, as the serial number of a ControllerConfiguration
that
has not yet been associated with a actual USB controller device.
Note that *all* serial numbers loaded in memory at any given instant are guaranteed unique and
different, even the fake ones; this allows code that processes USB-device-bound ControllerConfiguration
s to operate easily on unbound ones as well, a significant coding
simplification. The technology used in fake serial numbers, UUID
s, in fact guarantees
uniqueness across space and time, so fake serial numbers can be recorded persistently and
still maintain uniqueness. Historically, non-unique 'fake' serial numbers were also used: these
appeared int the form of "-1" or "N/A". When loaded from persistent storage, such legacy
fake serial numbers are converted to unique ones to maintain the uniqueness guarantee.Constructor and Description |
---|
SerialNumber()
Constructs a new unique, fake serial number
|
SerialNumber(java.lang.String initializer)
Constructs a serial number using the supplied initialization string.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object object) |
java.lang.String |
getSerialNumber()
Deprecated.
no need to use; use toString() if string form is sought
|
int |
hashCode() |
boolean |
isFake()
Returns whether or not this serial number is a fake one or not
|
static boolean |
isLegacyFake(java.lang.String initializer)
Returns whether the indicated serial number initialization string is one of the legacy
fake serial number forms or not.
|
boolean |
isReal()
Returns whether or not this serial number is a real one or not
|
java.lang.String |
toString() |
java.lang.String |
toString(Context context) |
public SerialNumber()
public SerialNumber(java.lang.String initializer)
initializer
- the initialization string for the serial number.public boolean isFake()
public boolean isReal()
public static boolean isLegacyFake(java.lang.String initializer)
initializer
- the serial number initialization string to testpublic boolean equals(java.lang.Object object)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String toString(Context context)
@Deprecated public java.lang.String getSerialNumber()