public final class DocumentUtils
extends java.lang.Object
A utility class for Document
.
Modifier and Type | Method and Description |
---|---|
static Filter |
createUniqueFilter(Document document)
Create unique filter to identify the
document . |
static <T> Document |
emptyDocument(NitriteMapper nitriteMapper,
java.lang.Class<T> type)
Creates an empty document from a
Class definition. |
static java.util.Set<java.lang.String> |
getFields(Document document)
Gets all first level fields of a document.
|
static java.lang.Object |
getFieldValue(Document document,
java.lang.String field)
Gets the value of a value inside a document.
|
static boolean |
isRecent(Document recent,
Document older)
Determines whether a document has recently been updated/created than the other.
|
public static java.util.Set<java.lang.String> getFields(Document document)
Gets all first level fields of a document.
document
- the document.public static java.lang.Object getFieldValue(Document document, java.lang.String field)
Gets the value of a value inside a document.
document
- the documentfield
- the valuepublic static <T> Document emptyDocument(NitriteMapper nitriteMapper, java.lang.Class<T> type)
Creates an empty document from a Class
definition. All value values
are initialized to null
. Such empty document is used for projection purpose.
T
- the type parameternitriteMapper
- the NitriteMapper
to create the document.type
- the class definition.public static boolean isRecent(Document recent, Document older)
Determines whether a document has recently been updated/created than the other.
recent
- the recent documentolder
- the older document