public final class View extends java.lang.Object implements ViewStoreDelegate
| Modifier and Type | Class and Description |
|---|---|
static class |
View.TDViewCollation |
| Modifier | Constructor and Description |
|---|---|
protected |
View(Database database,
java.lang.String name,
boolean create) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
Query |
createQuery()
Creates a new query object for this view.
|
void |
delete()
Deletes the view, persistently.
|
void |
deleteIndex()
Deletes the view's persistent index.
|
protected java.util.List<java.util.Map<java.lang.String,java.lang.Object>> |
dump() |
static ViewCompiler |
getCompiler()
The registered object, if any, that can compile map/reduce functions from source code.
|
int |
getCurrentTotalRows() |
protected Database |
getDatabase()
Get the database that owns this view.
|
java.lang.String |
getDocumentType()
Get document type.
|
long |
getLastSequenceIndexed()
Get the last sequence number indexed so far.
|
Mapper |
getMap()
The map function that controls how index rows are created from documents.
|
java.lang.String |
getMapVersion()
The current map version string.
|
java.lang.String |
getName()
Get the name of the view.
|
Reducer |
getReduce()
The optional reduce function, which aggregates together multiple rows.
|
int |
getTotalRows()
Get total number of rows in the view.
|
protected java.util.List<View> |
getViewsInGroup()
Get all views that have the same prefix if specified.
|
boolean |
isStale()
Is the view's index currently out of date?
|
static java.lang.Object |
keyForPrefixMatch(java.lang.Object key,
int depth)
Changes a maxKey into one that also extends to any key it matches as a prefix
|
java.util.List<QueryRow> |
query(QueryOptions options)
Queries the view.
|
void |
setCollation(View.TDViewCollation collation) |
static void |
setCompiler(ViewCompiler compiler)
Registers an object that can compile map/reduce functions from source code.
|
void |
setDocumentType(java.lang.String docType)
Set document type.
|
boolean |
setMap(Mapper mapBlock,
java.lang.String version)
Defines a view that has no reduce function.
|
boolean |
setMapReduce(Mapper mapBlock,
Reducer reduceBlock,
java.lang.String version)
Defines a view's functions.
|
java.lang.String |
toString() |
static double |
totalValues(java.util.List<java.lang.Object> values)
Utility function to use in reduce blocks.
|
Status |
updateIndex()
Updates the view's index (incrementally) if necessary.
|
Status |
updateIndexAlone()
Updates the view's index (incrementally) if necessary.
|
protected Status |
updateIndexes(java.util.List<View> views)
Update multiple view indexes at once.
|
protected View(Database database, java.lang.String name, boolean create) throws CouchbaseLiteException
CouchbaseLiteExceptionpublic Mapper getMap()
getMap in interface ViewStoreDelegatepublic Reducer getReduce()
getReduce in interface ViewStoreDelegatepublic java.lang.String getMapVersion()
ViewStoreDelegategetMapVersion in interface ViewStoreDelegatepublic java.lang.String getDocumentType()
getDocumentType in interface ViewStoreDelegatepublic void setDocumentType(java.lang.String docType)
protected Database getDatabase()
public java.lang.String getName()
public boolean setMapReduce(Mapper mapBlock, Reducer reduceBlock, java.lang.String version)
public boolean setMap(Mapper mapBlock, java.lang.String version)
public boolean isStale()
public int getTotalRows()
public long getLastSequenceIndexed()
public void deleteIndex()
public void delete()
public Query createQuery()
public static double totalValues(java.util.List<java.lang.Object> values)
public static ViewCompiler getCompiler()
public static void setCompiler(ViewCompiler compiler)
public int getCurrentTotalRows()
public void close()
public void setCollation(View.TDViewCollation collation)
public Status updateIndex() throws CouchbaseLiteException
CouchbaseLiteExceptionpublic Status updateIndexAlone() throws CouchbaseLiteException
CouchbaseLiteExceptionprotected Status updateIndexes(java.util.List<View> views) throws CouchbaseLiteException
views - a list of views whose index will be updated.CouchbaseLiteExceptionprotected java.util.List<View> getViewsInGroup()
public java.util.List<QueryRow> query(QueryOptions options) throws CouchbaseLiteException
options - The options to use.CouchbaseLiteExceptionpublic static java.lang.Object keyForPrefixMatch(java.lang.Object key,
int depth)
protected java.util.List<java.util.Map<java.lang.String,java.lang.Object>> dump()
public java.lang.String toString()
toString in class java.lang.Object