Class DesignDocument
- java.lang.Object
-
- com.couchbase.client.java.manager.view.DesignDocument
-
-
Constructor Summary
Constructors Constructor Description DesignDocument(String name)Creates a new design document with the given name and no views.DesignDocument(String name, Map<String,View> views)Creates a new design document with the given name and views.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object o)Optional<View>getView(String name)Returns the view with the given name, if it exists.inthashCode()Stringname()Returns the name of the design document.DesignDocumentname(String name)Assigns a new name to this design document.DesignDocumentputView(String name, View view)Convenience method for adding a view to this design document (replacing any existing view with the same name).DesignDocumentputView(String name, String map)Convenience method for adding a view to this design document (replacing any existing view with the same name).DesignDocumentputView(String name, String map, String reduce)Convenience method for adding a view to this design document (replacing any existing view with the same name).DesignDocumentremoveView(String name)Removes the view with the give name, if it exists.StringtoString()Map<String,View>views()Returns the views in this document indexed by name.DesignDocumentviews(Map<String,View> views)Sets all of the views for this design document, overriding any existing views.
-
-
-
Constructor Detail
-
DesignDocument
public DesignDocument(String name)
Creates a new design document with the given name and no views.- Parameters:
name- name for the design document
-
-
Method Detail
-
name
public String name()
Returns the name of the design document.
-
views
public Map<String,View> views()
Returns the views in this document indexed by name. Changes to the returned map affect the document, so for example you can remove all views by callingmyDesignDoc.views().clear().
-
putView
public DesignDocument putView(String name, String map)
Convenience method for adding a view to this design document (replacing any existing view with the same name).
-
putView
public DesignDocument putView(String name, String map, String reduce)
Convenience method for adding a view to this design document (replacing any existing view with the same name).
-
putView
public DesignDocument putView(String name, View view)
Convenience method for adding a view to this design document (replacing any existing view with the same name).
-
getView
public Optional<View> getView(String name)
Returns the view with the given name, if it exists.- Parameters:
name- name of the view to return
-
removeView
public DesignDocument removeView(String name)
Removes the view with the give name, if it exists.- Parameters:
name- name of the view to remove- Returns:
- the design document, for method chaining.
-
name
public DesignDocument name(String name)
Assigns a new name to this design document.- Parameters:
name- new name for the design document.- Returns:
- the design document, for method chaining.
-
views
public DesignDocument views(Map<String,View> views)
Sets all of the views for this design document, overriding any existing views.- Parameters:
views- map from view name to view- Returns:
- the design document, for method chaining.
-
-