Record Class DavOptions

java.lang.Object
java.lang.Record
org.exoplatform.caldav.client.DavOptions
Record Components:
davTokens - the compliance classes, lower-cased, never null
allowedMethods - the allowed methods, upper-cased, never null

public record DavOptions(Set<String> davTokens, Set<String> allowedMethods) extends Record
What a resource says it supports, as CalDavClient.capabilities(org.exoplatform.caldav.client.CalDavEndpoint, java.lang.String) gathers it: the compliance classes of its DAV header (RFC 4918 §10.1) and the methods of its Allow header (RFC 9110 §10.2.1) — the two pieces of evidence the sharing capability is selected from (EXO-90253).

Normalised once, here: compliance classes are compared case-insensitively and methods by their upper-case name, and a header a server repeats is read as the union of its values, which is what RFC 9110 §5.3 makes of a list header sent twice.

  • Constructor Details

    • DavOptions

      public DavOptions(Set<String> davTokens, Set<String> allowedMethods)
      Creates an instance of a DavOptions record class.
      Parameters:
      davTokens - the value for the davTokens record component
      allowedMethods - the value for the allowedMethods record component
  • Method Details

    • of

      public static DavOptions of(List<String> davHeaders, List<String> allowHeaders)
      The evidence as two raw header value lists.
      Parameters:
      davHeaders - every DAV header value the server sent
      allowHeaders - every Allow header value the server sent
      Returns:
      the normalised evidence
    • advertises

      public boolean advertises(String token)
      Whether the DAV header carries a compliance class.
      Parameters:
      token - the class, any case
      Returns:
      true when advertised
    • allows

      public boolean allows(String method)
      Whether the Allow header names a method.
      Parameters:
      method - the method name, any case
      Returns:
      true when allowed
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • davTokens

      public Set<String> davTokens()
      Returns the value of the davTokens record component.
      Returns:
      the value of the davTokens record component
    • allowedMethods

      public Set<String> allowedMethods()
      Returns the value of the allowedMethods record component.
      Returns:
      the value of the allowedMethods record component