Package org.dizitart.no2.collection
Class NitriteId
- java.lang.Object
-
- org.dizitart.no2.collection.NitriteId
-
- All Implemented Interfaces:
Serializable,Comparable<NitriteId>
public final class NitriteId extends Object implements Comparable<NitriteId>, Serializable
A unique identifier across the Nitrite database. Each document in a nitrite collection is associated with aNitriteId.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:
NitriteCollection.getById(NitriteId), Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(NitriteId other)static NitriteIdcreateId(String value)Creates aNitriteIdfrom a value.booleanequals(Object o)StringgetIdValue()Gets the underlying value of the NitriteId.inthashCode()static NitriteIdnewId()Creates a new auto-generatedNitriteId.StringtoString()static booleanvalidId(Object value)Validates a value to be used asNitriteId.
-
-
-
Method Detail
-
newId
public static NitriteId newId()
Creates a new auto-generatedNitriteId.- Returns:
- a new auto-generated
NitriteId.
-
createId
public static NitriteId createId(String value)
Creates aNitriteIdfrom a value.The value must be a string representation of a 64bit integer number.
- Parameters:
value- the value- Returns:
- the
NitriteId
-
validId
public static boolean validId(Object value)
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`.
-
compareTo
public int compareTo(NitriteId other)
- Specified by:
compareToin interfaceComparable<NitriteId>
-
getIdValue
public String getIdValue()
Gets the underlying value of the NitriteId.The value is a string representation of a 64bit integer number.
-
-