public final class NSUID extends NSObject
NSNumber or NSDictionary.
Because I can not make a well informed choice
we will inheirit from NSObject for now.
toMap() and toList() are overridden to return a single entry.
The key of the entry in the map is "CF$UID".| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
CFUIDKEY
The string CF$UID, used in XML Property List files
|
| Constructor and Description |
|---|
NSUID(long cfUid)
Construct a new object with a given CF$UID.
|
| Modifier and Type | Method and Description |
|---|---|
long |
getCfUid()
Return the CF$UID value
|
java.lang.Long |
getValue()
Get the unmodifiable value of this object.
|
boolean |
isTrue()
This implementation considers the CF$UID to be true if the value of cfUid is bigger than 0.
|
byte[] |
toBytes()
Get the raw data of the value.
|
double |
toDouble()
Return the value as a double.
|
java.util.List<NSInteger> |
toList()
Return a list which has one item.
|
long |
toLong()
Return the value as a long.
|
java.util.SortedMap<java.lang.String,NSObject> |
toMap()
Return a map which has one entry, which has the key "CF$UID".
|
java.lang.Long |
toNumber()
Return the value as a number.
|
NSUID |
toObject()
Returns itself because there is no Java equivalent for NSUID.
|
equals, fromObject, hashCode, toBoolean, toDate, toInteger, toListObject, toMapObject, toStream, toStringpublic static final java.lang.String CFUIDKEY
public NSUID(long cfUid)
cfUid - the CF$UIDpublic java.lang.Long getValue()
public java.util.SortedMap<java.lang.String,NSObject> toMap()
NSInteger and contains the value of this NSUID.public java.util.List<NSInteger> toList()
NSInteger and contains the value of this NSUID.public long toLong()
NSObjectNSInteger
the long value is derived from the actual value.toLong in class NSObjectgetCfUid()public double toDouble()
NSObjectNSReal
the double value is derived from the actual value.toDouble in class NSObjectgetCfUid()public java.lang.Long toNumber()
NSObjectReturn the value as a number.
If this is not a NSNumber
the number is derived from the value.
The number is derived in the following way
NSNumber: the actual number valueNSCollection: the amount of childrenNSData: the length in bytesNSBoolean: always byte; 0 for false, 1 for trueNSString: If the String is numeric, return the number in the string. Otherwise return 0*If you need to be sure about the result (e.g. you need to know if the result is user intended or a guess) you should do instanceof checks yourself.
*This behaviour is exactly as the library works and even though one could argue that the method should return null instead of 0, the method returns 0 and will never return null. There are a couple reasons for this:
NSObject.toLong() and NSObject.toDouble() use NSObject.toNumber();NullPointerExceptions.NSObject.toNumber() on any NSObject is dirty anyway.NSObject is an NSNumber.toNumber in class NSObjectgetCfUid()public long getCfUid()
public boolean isTrue()
public NSUID toObject()