Package org.dizitart.no2.collection
Class NitriteId
java.lang.Object
org.dizitart.no2.collection.NitriteId
- All Implemented Interfaces:
Serializable,Comparable<NitriteId>
A unique identifier across the Nitrite database. Each document in
a nitrite collection is associated with a
NitriteId.
During insertion if a unique object is supplied in the '_id' field
of the document, then the value of the '_id' field will be used to
create a new NitriteId. If the '_id' field is not supplied, then
nitrite will generate a new [NitriteId] and will add it to the document.
- Since:
- 1.0
- Author:
- Anindya Chatterjee
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionintstatic NitriteIdcreateId(long value) Creates aNitriteIdfrom alongvalue.static NitriteIdCreates aNitriteIdfrom a value.booleanlongThe underlying value of the NitriteId.longinthashCode()static NitriteIdnewId()Creates a new auto-generatedNitriteId.toString()static booleanValidates a value to be used asNitriteId.
-
Method Details
-
newId
Creates a new auto-generatedNitriteId.- Returns:
- a new auto-generated
NitriteId.
-
createId
Creates aNitriteIdfrom a value.The value must be a string representation of a 64bit integer number.
- Parameters:
value- the value- Returns:
- the
NitriteId
-
createId
Creates aNitriteIdfrom alongvalue.- Parameters:
value- the value- Returns:
- the
NitriteId
-
validId
Validates a value to be used asNitriteId.The value must be a string representation of a 64bit integer number.
- Parameters:
value- the value- Returns:
- `true` if the value is valid; otherwise `false`.
-
getIdValue
public long getIdValue() -
compareTo
- Specified by:
compareToin interfaceComparable<NitriteId>
-
toString
-
get_idValue
public long get_idValue()The underlying value of the NitriteId. -
equals
-
hashCode
public int hashCode()
-