Class DesignDocument
java.lang.Object
com.couchbase.client.java.manager.view.DesignDocument
@Volatile public class DesignDocument extends Object
A collection of named
Views.-
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
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 Details
-
DesignDocument
Creates a new design document with the given name and no views.- Parameters:
name- name for the design document
-
DesignDocument
Creates a new design document with the given name and views.- Parameters:
name- name for the design documentviews- map from view name to view
-
-
Method Details
-
name
Returns the name of the design document. -
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
Convenience method for adding a view to this design document (replacing any existing view with the same name). -
putView
Convenience method for adding a view to this design document (replacing any existing view with the same name). -
putView
Convenience method for adding a view to this design document (replacing any existing view with the same name). -
getView
Returns the view with the given name, if it exists.- Parameters:
name- name of the view to return
-
removeView
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
Assigns a new name to this design document.- Parameters:
name- new name for the design document.- Returns:
- the design document, for method chaining.
-
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.
-
toString
-
equals
-
hashCode
public int hashCode()
-