public final class ObjectUtils
extends java.lang.Object
A utility class for Object
.
Modifier and Type | Method and Description |
---|---|
static ObjectFilter |
createUniqueFilter(java.lang.Object object,
java.lang.reflect.Field idField)
Creates unique filter from the object.
|
static <T> java.util.Set<Index> |
extractIndices(NitriteMapper nitriteMapper,
java.lang.Class<T> type)
Extract indices information by scanning for
Index annotated fields. |
static <T> java.lang.String |
findObjectStoreName(java.lang.Class<T> type)
Generates the name of an
ObjectRepository . |
static <T> java.lang.String |
findObjectStoreName(java.lang.String key,
java.lang.Class<T> type)
Generates the name of an
ObjectRepository
with an unique key identifier. |
static <T> java.lang.reflect.Field |
getIdField(NitriteMapper nitriteMapper,
java.lang.Class<T> type)
Gets the field marked with
Id annotation. |
static boolean |
isKeyedObjectStore(java.lang.String collectionName)
Checks whether a collection name is a valid keyed object store name.
|
static boolean |
isObjectStore(java.lang.String collectionName)
Checks whether a collection name is a valid object store name.
|
static <T> T |
newInstance(java.lang.Class<T> type) |
static <T> Document |
toDocument(T object,
NitriteMapper nitriteMapper,
java.lang.reflect.Field idField,
boolean update) |
public static <T> java.lang.String findObjectStoreName(java.lang.Class<T> type)
Generates the name of an ObjectRepository
.
T
- the type parametertype
- the type of object stored in the repositorypublic static <T> java.lang.String findObjectStoreName(java.lang.String key, java.lang.Class<T> type)
Generates the name of an ObjectRepository
with an unique key identifier.
T
- the type parameterkey
- the key identifiertype
- the type of object stored in the repositorypublic static <T> java.util.Set<Index> extractIndices(NitriteMapper nitriteMapper, java.lang.Class<T> type)
Extract indices information by scanning for Index
annotated fields.
T
- the type parameternitriteMapper
- the NitriteMapper
type
- the type of the object stored in the repositoryIndex
annotations found.public static <T> java.lang.reflect.Field getIdField(NitriteMapper nitriteMapper, java.lang.Class<T> type)
Gets the field marked with Id
annotation.
T
- the type parameternitriteMapper
- the nitrite mappertype
- the typepublic static ObjectFilter createUniqueFilter(java.lang.Object object, java.lang.reflect.Field idField)
Creates unique filter from the object.
object
- the objectidField
- the id fieldpublic static boolean isObjectStore(java.lang.String collectionName)
Checks whether a collection name is a valid object store name.
collectionName
- the collection nametrue
if it is a valid object store name; false
otherwise.public static boolean isKeyedObjectStore(java.lang.String collectionName)
Checks whether a collection name is a valid keyed object store name.
collectionName
- the collection nametrue
if it is a valid object store name; false
otherwise.public static <T> T newInstance(java.lang.Class<T> type)
public static <T> Document toDocument(T object, NitriteMapper nitriteMapper, java.lang.reflect.Field idField, boolean update)