package org.xbib.io.webdav.common;

import org.xbib.io.webdav.api.DavConstants;
import org.xbib.io.webdav.api.PropEntry;
import org.xbib.io.webdav.api.XMLizable;

/**
 * The <code>Property</code> class represents a Property of a WebDAV
 * resource. The {@link Object#hashCode()} and {@link Object#equals(Object)} methods are
 * overridden in a way, such that the name and value of the property are
 * respected. This means, a property is equal to another if the names
 * and values are equal.<br>
 * The XML representation of a <code>DavProperty</code>:
 * <pre>
 * new DavProperty("displayname", "WebDAV Directory").toXml
 * gives a element like:
 * &lt;D:displayname&gt;WebDAV Directory&lt;/D:displayname&gt;
 *
 * new DavProperty("resourcetype", new Element("collection")).toXml
 * gives a element like:
 * &lt;D:resourcetype&gt;&lt;D:collection/&gt;&lt;/D:resourcetype&gt;
 *
 * Element[] customVals = { new Element("bla", customNamespace), new Element("bli", customNamespace) };
 * new DavProperty("custom-property", customVals, customNamespace).toXml
 * gives an element like
 * &lt;Z:custom-property&gt;
 *    &lt;Z:bla/&gt;
 *    &lt;Z:bli/&gt;
 * &lt;/Z:custom-property&gt;
 * </pre>
 */
public interface DavProperty<T> extends XMLizable, DavConstants, PropEntry {

    /**
     * Returns the name of this property
     *
     * @return the name of this property
     */
    DavPropertyName getName();

    /**
     * Returns the value of this property
     *
     * @return the value of this property
     */
    T getValue();

    /**
     * Return <code>true</code> if this property should be suppressed
     * in a PROPFIND/{@link DavConstants#PROPFIND_ALL_PROP DAV:allprop}
     * response. See RFC 4918, Section 9.1.
     *
     * @return true, if this property should be suppressed in a PROPFIND/allprop response
     */
    boolean isInvisibleInAllprop();
}
