code: public static DesignDocument from(final String name, final JsonObject raw) {
          final List<View> views = new ArrayList<View>();
  
          JsonObject rawViews = raw.getObject("views");
          if (rawViews != null) {
              for(String viewName: rawViews.getNames()) {
                  JsonObject viewContent = rawViews.getObject(viewName);
                  String map = viewContent.getString("map");
                  String reduce = viewContent.getString("reduce");
                  views.add(DefaultView.create(viewName, map, reduce));
              }
          }
  
          JsonObject spatialViews = raw.getObject("spatial");
          if (spatialViews != null) {
              for(String viewName : spatialViews.getNames()) {
                  String map = spatialViews.getString(viewName);
                  views.add(SpatialView.create(viewName, map));
              }
          }
  
          JsonObject opts = raw.getObject("options");
          final Map<Option, Long> options = new HashMap<Option, Long>();
          if (opts != null) {
              for (String key : opts.getNames()) {
                  options.put(Option.fromName(key), opts.getLong(key));
              }
          }
  
          return new DesignDocument(name, views, options);
      }
docs: 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 (see {@link Option}).
  
  @param name the name of the design document.
  @param raw the raw JSON representing the design document.
  @return the corresponding DesignDocument object.