Class DesignDocument

java.lang.Object
com.couchbase.client.java.manager.view.DesignDocument

@Volatile public class DesignDocument extends Object
A collection of named Views.
  • Constructor Details

    • DesignDocument

      public DesignDocument(String name)
      Creates a new design document with the given name and no views.
      Parameters:
      name - name for the design document
    • DesignDocument

      public DesignDocument(String name, Map<String,View> views)
      Creates a new design document with the given name and views.
      Parameters:
      name - name for the design document
      views - map from view name to view
  • Method Details

    • 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 calling myDesignDoc.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.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object