public abstract class AbstractDocumentTemplate extends Object implements DocumentTemplate
DocumentTemplate interface,
to minimize the effort required to implement this interface.| Constructor and Description |
|---|
AbstractDocumentTemplate() |
| Modifier and Type | Method and Description |
|---|---|
<T> long |
count(Class<T> entityClass)
Returns the number of elements from document collection
|
long |
count(String documentCollection)
Returns the number of elements from document collection
|
<T,ID> void |
delete(Class<T> entityClass,
ID id)
Deletes by Id.
|
void |
delete(org.jnosql.diana.api.document.DocumentDeleteQuery query)
Deletes an entity
|
<T,ID> Optional<T> |
find(Class<T> entityClass,
ID id)
Finds by Id.
|
protected abstract ClassRepresentations |
getClassRepresentations() |
protected abstract DocumentEntityConverter |
getConverter() |
protected abstract Converters |
getConverters() |
protected abstract org.jnosql.diana.api.document.DocumentCollectionManager |
getManager() |
protected abstract DocumentEventPersistManager |
getPersistManager() |
protected abstract DocumentWorkflow |
getWorkflow() |
<T> T |
insert(T entity)
Saves entity
|
<T> T |
insert(T entity,
Duration ttl)
Saves entity with time to live
|
PreparedStatement |
prepare(String query)
Creates a
PreparedStatement from the query |
<T> List<T> |
query(String query)
Executes a query then bring the result as a
List |
<T> List<T> |
select(org.jnosql.diana.api.document.DocumentQuery query)
Finds entities from query
|
<T> Optional<T> |
singleResult(String query)
Executes a query then bring the result as a unique result
|
<T> T |
update(T entity)
Updates a entity
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitinsert, insert, singleResult, updateprotected abstract DocumentEntityConverter getConverter()
protected abstract org.jnosql.diana.api.document.DocumentCollectionManager getManager()
protected abstract DocumentWorkflow getWorkflow()
protected abstract DocumentEventPersistManager getPersistManager()
protected abstract ClassRepresentations getClassRepresentations()
protected abstract Converters getConverters()
public <T> T insert(T entity)
DocumentTemplateinsert in interface DocumentTemplateT - the instance typeentity - entity to be savedpublic <T> T insert(T entity,
Duration ttl)
DocumentTemplateinsert in interface DocumentTemplateT - the instance typeentity - entity to be savedttl - the time to livepublic <T> T update(T entity)
DocumentTemplateupdate in interface DocumentTemplateT - the instance typeentity - entity to be updatedpublic void delete(org.jnosql.diana.api.document.DocumentDeleteQuery query)
DocumentTemplatedelete in interface DocumentTemplatequery - query to delete an entitypublic <T> List<T> select(org.jnosql.diana.api.document.DocumentQuery query)
DocumentTemplateselect in interface DocumentTemplateT - the instance typequery - - query to figure out entitiespublic <T,ID> Optional<T> find(Class<T> entityClass, ID id)
DocumentTemplatefind in interface DocumentTemplateT - the entity class typeID - the id typeentityClass - the entity classid - the id valueOptional.empty()public <T,ID> void delete(Class<T> entityClass, ID id)
DocumentTemplatedelete in interface DocumentTemplateT - the entity class typeID - the id typeentityClass - the entity classid - the id valuepublic <T> List<T> query(String query)
DocumentTemplateListquery in interface DocumentTemplateT - the entity typequery - the queryListpublic <T> Optional<T> singleResult(String query)
DocumentTemplatesingleResult in interface DocumentTemplateT - the entity typequery - the queryListpublic PreparedStatement prepare(String query)
DocumentTemplatePreparedStatement from the queryprepare in interface DocumentTemplatequery - the queryPreparedStatement instancepublic long count(String documentCollection)
DocumentTemplatecount in interface DocumentTemplatedocumentCollection - the document collectionpublic <T> long count(Class<T> entityClass)
DocumentTemplatecount in interface DocumentTemplateT - entityTypeentityClass - the document collectionCopyright © 2018. All rights reserved.