Package com.couchbase.client.java.view
Class DesignDocument
java.lang.Object
com.couchbase.client.java.view.DesignDocument
public class DesignDocument extends Object
Represents a design document to store and load.
- Since:
- 2.0
- Author:
- Michael Nitschinger
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
DesignDocument.Option
Optional design document options. -
Constructor Summary
Constructors Modifier Constructor Description protected
DesignDocument(String name, List<View> views, Map<DesignDocument.Option,Long> options)
-
Method Summary
Modifier and Type Method Description static DesignDocument
create(String name, List<View> views)
Creates a newDesignDocument
.static DesignDocument
create(String name, List<View> views, Map<DesignDocument.Option,Long> options)
Creates a newDesignDocument
.boolean
equals(Object o)
static DesignDocument
from(String name, JsonObject raw)
Create a design document from a JSON representation of it.int
hashCode()
String
name()
Map<DesignDocument.Option,Long>
options()
JsonObject
toJsonObject()
String
toString()
List<View>
views()
Returns a list of the views (raw and spatial) contained in the design document.
-
Constructor Details
-
DesignDocument
-
-
Method Details
-
create
Creates a newDesignDocument
.- Parameters:
name
- the name of the design document.views
- all views it contains.- Returns:
- a new
DesignDocument
.
-
create
public static DesignDocument create(String name, List<View> views, Map<DesignDocument.Option,Long> options)Creates a newDesignDocument
.- Parameters:
name
- the name of the design document.views
- all views it contains.options
- optional options of the design document.- Returns:
- a new
DesignDocument
.
-
from
Create a design document from a JSON representation of it. The JSON is expected to contain 3 JSON objects: a "views" object with an entry for each raw view, a "spatial" object for spatial views and an "options" object for design document options (seeDesignDocument.Option
).- Parameters:
name
- the name of the design document.raw
- the raw JSON representing the design document.- Returns:
- the corresponding DesignDocument object.
-
name
- Returns:
- the name of the DesignDocument.
-
views
Returns a list of the views (raw and spatial) contained in the design document. When you obtain this DesignDocument from the SDK, you can mutate the list. Once you upsert the DesignDocument again, this allows you to add a view or even replace an existing view definition (make sure the updated definition uses the same name as the original and is inserted last).- Returns:
- the list of
Views
in the design document.
-
options
- Returns:
- the
Options
set on the design document and their values.
-
toString
-
toJsonObject
-
equals
-
hashCode
public int hashCode()
-