package org.jcouchdb.document;


/**
 * Encapsulates a view inside a {@link DesignDocument}.
 *
 * @author shelmberger
 *
 */
public class View
{
    private String map,reduce;

    public View()
    {

    }

    public View(String mapFn)
    {
        setMap(mapFn);
    }

    public View(String mapFn, String reduceFn)
    {
        setMap(mapFn);
        setReduce(reduceFn);
    }

    public String getMap()
    {
        return map;
    }

    public void setMap(String map)
    {
        if (map != null && map.length() > 0)
        {
            this.map = map;
        }
        else
        {
            this.map = null;
        }
    }

    public String getReduce()
    {
        return reduce;
    }

    public void setReduce(String reduce)
    {
        if (reduce != null && reduce.length() > 0)
        {
            this.reduce = reduce;
        }
        else
        {
            this.reduce = null;
        }
    }

    @Override
    public String toString()
    {
        return super.toString()+": map = '"+map+", reduce='"+reduce+"'";
    }
}

@@ -25,16 +25,80 @@
 ument;%0A%0A
+import org.apache.log4j.Logger;%0Aimport org.jcouchdb.util.Util;%0A%0A
 %0A/**%0A * 
@@ -203,16 +203,79 @@
  View%0A%7B%0A
+    private static Logger log = Logger.getLogger(View.class);%0A%0A
     priv
@@ -1057,24 +1057,519 @@
    %7D%0A    %7D%0A%0A
+    @Override%0A    public boolean equals(Object obj)%0A    %7B%0A        boolean result = false;%0A        if (obj instanceof View)%0A        %7B%0A            View that = (View) obj;%0A            result = Util.equals(this.getMap(), that.getMap()) &&%0A                Util.equals(this.getReduce(), that.getReduce());%0A        %7D%0A        return result;%0A    %7D%0A%0A    @Override%0A    public int hashCode()%0A    %7B%0A        return 17 + 37 * Util.safeHashcode(this.getMap()) + 37 * Util.safeHashcode(this.getReduce());%0A    %7D%0A%0A
     @Overrid

make CouchDBUpdater ignore unchanged design documents